[web2py] Re: uploadfolder outside web2py

2018-01-12 Thread 黄祥
pls try: table.image.uploadfolder = os.path.join(request.folder, '..', '..', '..', 'webapps', 'uploads') assuming there are folders: /home/web2py/applications/adminmod /home/webapps/uploads according to your path, i think it just a little adjustment of parent folder ,'..', '..' best regards,

[web2py] decorator() takes exactly 1 argument (0 given)

2018-01-12 Thread mostwanted
Lately i am experiencing this error: * decorator() takes exactly 1 argument (0 given)* but i do not understand what it stems from, here is the controller below: def Company_Update(): details=db(db.company).select(db.company.ALL) details2=db(db.company).select(db.company.ALL) for dtls

[web2py] Re: auto increment field that reset evry year

2018-01-12 Thread tim . nyborg
I've done this with a table with a year as its id: idb.define_table( 'next_id', Field('year', 'id'), Field('next', 'integer'), ) def get_next_id(year): record = idb.next_id(year) if not record: # Auto add new years idb.next_id.insert(year=year, next=1)

[web2py] DB model reference field conditions eg. auth_user belonging to a certain group only

2018-01-12 Thread Oasis Agano
Greetings, I have defined a table referencing auth_user, but i want on the web form select box to only bring users belonging to one group, not showing all the system users. i am wondering if i should use a lambda function or if there is a way of adding a condition on a reference field. E,g

[web2py] Re: DB model reference field conditions eg. auth_user belonging to a certain group only

2018-01-12 Thread tim . nyborg
You can put conditions into the field validator: Field('writer_user', 'string', requires=IS_IN_DB( db( (db.auth_user.id == db.auth_membership.user_id) & (db.auth_membership.group_id == db.auth_group.id) & (db.auth_group.role

[web2py] Re: DB model reference field conditions eg. auth_user belonging to a certain group only

2018-01-12 Thread Anthony
On Friday, January 12, 2018 at 6:58:33 AM UTC-5, tim.nyb...@conted.ox.ac.uk wrote: > > You can put conditions into the field validator: > > Field('writer_user', 'reference auth_user', > requires=IS_IN_DB( > db( > (db.auth_user.id ==

[web2py] Re: decorator() takes exactly 1 argument (0 given)

2018-01-12 Thread Anthony
On Friday, January 12, 2018 at 5:31:35 AM UTC-5, mostwanted wrote: > > Lately i am experiencing this error: > * decorator() takes exactly 1 argument (0 > given)* but i do not understand what it stems from, here is the > controller below: > def Company_Update(): >

[web2py] Re: Clean app by script

2018-01-12 Thread Dave S
On Friday, January 12, 2018 at 1:10:04 AM UTC-8, Gaël Princivalle wrote: > > Hello. > > Is it possible to clean an app by script? > > Sometimes Web2py don't work anymore because it have too much log/error > files to manage. > > I remember a Massimo post about it but I've don't found it. > >

[web2py] Re: uploadfolder outside web2py

2018-01-12 Thread Dave S
On Friday, January 12, 2018 at 12:07:22 AM UTC-8, Annet wrote: > > In web2py I have an init application and an adminmod application > containing the model, module and static files. > > To manage images I have the following code in a function: > > > table.image.uploadfolder =

[web2py] Re: uploadfolder outside web2py

2018-01-12 Thread Anthony
On Friday, January 12, 2018 at 5:18:30 AM UTC-5, 黄祥 wrote: > > pls try: > table.image.uploadfolder = os.path.join(request.folder, '..', '..', '..', > 'webapps', 'uploads') > Also, unless it needs to be portable to other filesystems where the path does not start with "/home", you can simplify

[web2py] Re: Clean app by script

2018-01-12 Thread 黄祥
i think you can do it with shell script or batch script, create the script that remove (rm) or move (mv) the logs or error and execute it (manually (via web2py or terminal), schedully (cron) ) best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] uploadfolder outside web2py

2018-01-12 Thread 'Annet' via web2py-users
In web2py I have an init application and an adminmod application containing the model, module and static files. To manage images I have the following code in a function: table.image.uploadfolder = os.path.join(request.env.applications_parent, 'applications',

[web2py] Clean app by script

2018-01-12 Thread Gaël Princivalle
Hello. Is it possible to clean an app by script? Sometimes Web2py don't work anymore because it have too much log/error files to manage. I remember a Massimo post about it but I've don't found it. Thanks, regards. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -