Serge Bourgeois | 1 Feb 10:25 2015
Picon

ckeditor : how to make read only, how to remove the toolbar in a dynamic way

I just implemented the ckeditor plugin. It looks great, but I need help (example if possible) showing how to hide the ckeditor toolbar for some text fields, for instance in a controller with a smartgrid, where request.args does not contain 'now' nor 'edit'.
Thanks in advance !
Serge

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Louis Amon | 1 Feb 10:18 2015
Picon

Memory leaks in web2py : how do you track them ?

I have a web2py server running on heroku.

So far my server had little traffic, and Heroku being a cloud PaaS service means they put processes to sleep if they're not used for a while.

Because of that, I never really noticed that the memory signature of my application was growing at every request until my server got put to sleep due to inactivity (at night most often), and thus the memory was reset upon restart.

This is no longer the case, and now my server often becomes unavailable due to memory quotas, which is a big issue on production.


I've been using several tools to track the memory usage of web2py, one of which is the logs of Heroku itself, eg:

2015-02-01T09:01:46.965380+00:00 heroku[web.1]: source=web.1 dyno=heroku.28228261.c4fede81-d205-4dad-b07e-2ad6dcc49a0f sample#memory_total=186.27MB sample#memory_rss=180.75MB sample#memory_cache=5.52MB sample#memory_swap=0.00MB sample#memory_pgpgin=71767pages sample#memory_pgpgout=24081pages


As far as I can tell, the "memory_cache" signature is rather small and is stable around 5MB (I don't use cache a lot on my website, precisely for fear of memory leaks).

Based on the documentation, "memory_rss" on Heroku refers to:
  • Resident Memory (memory_rss): The portion of the dyno’s memory (megabytes) held in RAM.
 This variable keeps growing at every request, seemingly regardless of which page is accessed.

You will find attached the memory chart of my app, taken from Heroku's Metrics back-office : every vertical line is a hard reset I had to do manually to prevent the app from exceeding quotas. The red zone is a server downtime because of swap usage making requests to be served very very slowly.


I've tried using the "memory_profiler" library to decorate some functions in my code and try to track memory usage increase, but it is a very tedious task and so far I haven't managed to find the root of my problem.


I suspect my issue to be in models since those are loaded on every request, but I can't use memory_profiler on them since models aren't natively encapsulated in any function.


Is there a function somewhere in Gluon that loads every model, and which I could decorate to scope which model might have memory leaks ?

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
LoveWeb2py | 1 Feb 01:11 2015
Picon

web2py-menu-active li_active='active' help


Hello,

I tried following this example:
http://web2py.com/books/default/chapter/29/05/the-views#MENU

This thread:
https://groups.google.com/forum/#!msg/web2py/Jc2qOVJ-Zws/yLzKdWb-y3cJ

Is there a way in my menu to dynamically change the False to True based on request? I've tried following the examples and nothing seems to work.

li_active="active" is really all I need. I just want to set the class to active when its clicked.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Gael Princivalle | 1 Feb 00:13 2015
Picon

Module path

Hello.

When I use a function from a personal application module, the function is found when I load the application clicking on the "try view" button in the web2py editor.
Bit if I try to load the same page on the application domain, www.mydomain.com, web2py don't found the function.

Is it a routes.py problem?
routers = dict(
BASE = dict(
        domains = {
   "www.mydomain.com" : "my_application",
},
default_application='welcome',
),
)

As this application is on a dedicated server where the administrator is not familiar with web2py, it's perhaps a server configuration problem? 

I've put this function in the application module. I think there's a way to define global modules for the complete web2py application. How can I do it?

Thanks.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Alex Glaros | 31 Jan 22:15 2015
Picon

off topic: How to model internal mail tables?

Seems that there are complicated requirements for just a basic internal message model such as in Facebook and LinkedIn.

Has anyone modeled messages; have ideas on how to do it?

One 1:M idea is to create only one message-body record, and have recipients use a child table that links to body:
BODY-table - only one record shared by all recipients
----------
messageID
senderID
subjectLine
messageBody
dateSent
senderDeleteBoolean (hides from sender, but all recipients that didn't delete can still view)
senderArchiveBoolean
threadID

RECIPIENT-Table
---------------
messageID
recipientID
dateRead
archiveBoolean

thanks

Alex Glaros





--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Aydin S | 31 Jan 20:43 2015
Picon

Why web2py does not run on startup using crontab


Hi, does anyone know why web2py does not run on startup using crantab? (linux machine)

When I call web2py.py normally in terminal it works fine, python web2py.py.

When I put the following command in the crantab it does not run.  <at> reboot python /root/web2py.py &

I've tested to see if the crontab can run other python files and it can. 

I've read the group for possible solutions, I tried to enable -Y, -C and -J but no help. 

Any idea that can help?


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Anthony Smith | 31 Jan 11:18 2015
Picon

Adding the number of day to a date

Hi,
I am unable to find any information on adding the number of days to a date.

The number of days is stored in a table as a int

Second it where a task is created and a expiry is require using the completed date of the task + the number of days from the first table.

What is the best way to handle this?

thanks 



--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Dmitry Ermolaev | 31 Jan 09:52 2015
Picon

WebSocket as pusher.com

good idea:
https://pusher.com/docs/pusher_protocol
how insert same into web2py ?

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Manuel Moscariello | 30 Jan 12:23 2015
Picon

Global name 'crud' is not defined

Hello everybody,
this is my first post here, I'm right now in the study phase of web2py, getting pretty enthusiast about it.
I was following a tutorial I found on a discussion of this group, http://killer-web-development.com .

Now, at a stage I should append to my controllers/default.py:


def entry_post():
   
"""returns a form where the can entry a post"""
   
form = crud.create(db.post)
   
return dict(form=form)

Nothing difficoult or strange, I was still feeling confortable.
But when I then go to mysite/myapp/default/entry_post I get a ticket with a NameError:

<type 'exceptions.NameError'> global name 'crud' is not defined




I read the web2py book and crud.create(db.table) should be an accepted method, so why is this error raising?

Thanks you for your help, hope I am not asking a silly question but neither google or a research on your group helped me.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Tom Stratton | 30 Jan 01:40 2015

How can I change a form so that the Enter key is disabled for "Submit"

I'm finding that a lot of users are hitting Enter instead of Tab and I'm getting half-filled-in forms. I'd like to set the button to NOT default but not sure where to go about making that change.

Anyone have a solution?

Thanks

Tom

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
António Ramos | 30 Jan 16:15 2015
Picon

Dal tip . table to store upload from more than one table ?

Hello
i have an app with table A and B

Each record in A and B can have many upload files so i created table C and D respectively just to collect upload files from A and B

This is my table C and D (they are equal)

db.define_table('C_files',
        Field('f_emp_ref', db.A, notnull=True, writable=False, readable=False),
        Field('f_titulo', type='string', label=T('Categoria'), notnull=False),
        Field('f_doc', type='upload', autodelete=True,notnull=False, 
                label=T('Documentos'),
                represent=lambda x, row:x and A('%s'%(db.e_docs.f_doc.retrieve(x)[0]),
                                                _href=URL('default','viewer.html',args=x),
                                                _target="_blank",
                                                _title=T("open file"),
                                                _class='file-reference')
                                            or ''),
    )

db.define_table('D_files',
        Field('f_emp_ref', db.B, notnull=True, writable=False, readable=False),
        Field('f_titulo', type='string', label=T('Categoria'), notnull=False),
        Field('f_doc', type='upload', autodelete=True,notnull=False, 
                label=T('Documentos'),
                represent=lambda x, row:x and A('%s'%(db.e_docs.f_doc.retrieve(x)[0]),
                                                _href=URL('default','viewer.html',args=x),
                                                _target="_blank",
                                                _title=T("open file"),
                                                _class='file-reference')
                                            or ''),
    )

After that i realized that this looks stupid and i would like to short it as possible.


How can i have just table C to collect upload files from table A and B ?

Thank you
António

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Gmane