[web2py] Re: update existing project model without breaking backward compatibility...
perhaps i'm a bit old-fashioned, but i don't allow automatic SQL migrations on production. what i tend to do: - use automatic migrations in develop - record the SQL executed. - create a script that combines the migration SQL web2py generates with my data migration. - put production into maintenance mode - run SQL migration script - update source code - turn production back on so in your case my SQL migration script would: - create the new table - copy phone numbers into the new table from the existing table - drop the phone number column from the existing table. that's my perspective on the problem, good luck! christian On Sunday, March 24, 2013 4:29:19 AM UTC-7, Loïc wrote: Hello all, let's imagine I have an app with the following model : db.define_table('contact', Field('name'), Field('phone_number') ) I have already deployed my app, and I have several contacts with a name and a phone number. Then I realise that a contact can have multiple phone numbers. So I add a table : db.define_table('phone number', Field('type'), #mobile phone number, home phone number, business phone number ,... Field('phone_number'), Field('contact', 'reference contact'), ) The first time I launch my app with the new model, I want to move existing phone numbers from *contact *table to *phone_number *table. Then I want to remove 'phone_number' field from contact table to avoid using it in the future What is the best way to do this automatically, and without breaking backward compatibility? Thank you -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Sitemap Plugin or Sitemap Generator
Thanks so much for this code, it's really helpful. @BlueShadow - I keep my auth functions in a separate controller i.e. admin.py and can simply exclude this function from the list like so: if 'admin.py' in ctls: ctls.remove('admin.py') If you have functions in default.py that you wish to exclude you can create a list and have these items excluded in the loop, like so: exclusions = ['user','unsubscribe'] for ctl in ctls: if ctl.endswith(.bak) == False: filename = os.path.join(ctldir,ctl) data = open(filename, 'r').read() functions = regex_expose.findall(data) ctl = ctl[:-3].replace(_, ) for f in functions: if not any(f in s for s in exclusions): # if function is not in exclustions sitemap.append(TAG.url(TAG.loc( 'http://www.leandro.inf.br/%s/%s/%s' % (request.application,ctl,f.replace( _, ) Not sure why your deleted function is appearing, the code dynamically generates the sitemap on request. I hope that helps. -James On Monday, March 25, 2013 1:06:14 AM UTC+13, BlueShadow wrote: This Sitemap generator is great! But I got a couple questions about it.can you remove all entries which require authorisation? I tried it for one of my applications and it shows an entry for a long deleted function(the view has been deleted too). why is that happening? -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] IMG in A tag of SQLFORM `submit_button`?
{{=SQLFORM.factory(submit_button=XML(SPAN('hello', IMG(_src=URL('static', 'img/bg.png')}} How do I get this to work? Thanks for all suggestions, Alec Taylor -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] non-wiki-editor sees [wiki] dropdown menu
Hello everybody, I'm using auth.wiki() in my simple app. Now I have 2 user records, the first user is in groups of user_1 and wiki-editor, the other user is in group of CommonUser. What I understand is according to autho.wiki() settings, the *[wiki]* menu will only be exposed to user_1 and wiki-editor. Now when i loggin with role of CommonUser I can still see the *[wiki]* but when clicking any function it gives 401 UNAUTHORIZED error (which should be so). How to hide *[wiki]* from non-wiki-editor users in my case? Thanks for any reply. Spring -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] flash after callback
Hi folks, I am trying to do a session.flash after a function is called via A('func', callback('func')). A simple session.flash in the callback function like: def func(): session.flash('test') return dict() is not working. I found an old thread that suggests: def func(): return 'jQuery(.flash).html(test).slideDown().delay(1000).slideUp();' and I think in the view I would have to add: {{=A('func', callback('func'), target='t')}} div id=t/div but that does not work. Nothing is shown. Any ideas? -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] SQLFORM.grid 'headers' doesn't change column header
I created the following form: SQLFORM.grid(dbm.groups_subjects, headers={'table1.field1':T('Myname1')) The names of columns that are set in headers are shown correctly (I see * Myname1* as header). But when I press view or create, I see '*field1*' as column header instead of *'Myname1'* -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid 'headers' doesn't change column header
the form has normally the label of that field . headers are for the table representation only On Tuesday, March 26, 2013 11:01:03 AM UTC+1, Andrii Pitukh wrote: I created the following form: SQLFORM.grid(dbm.groups_subjects, headers={'table1.field1':T('Myname1')) The names of columns that are set in headers are shown correctly (I see * Myname1* as header). But when I press view or create, I see '*field1*' as column header instead of *'Myname1'* -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod niph...@gmail.com On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy processing the task and the underlying thread reaches the let's assign tasks loop, the logic will be skipped (it's unuseful to assign tasks if a worker is already processing them). So it can happen that even if the assignment time has come, if the worker is processing tasks it will skip the assignment Actually I have just seen the stop time, on average the task completes it cycle in just a few seconds (~1-2). Given that, is what you have suggested still valid? Nope. As I said it guaranteed that even in the case that the assignment loop falls into the timeframe of a RUNNING task, at the next round it will be picked up Last but not least, demo1 has gone in timeout after one successful cycle, this is very odd, How I can debug the scheduler application and find its errors? I am running scheduler as a linux service, as described here: http://web2py.com/books/**default/chapter/29/13#Start-** the-scheduler-as-a-Linux-**service-%28upstart%29http://web2py.com/books/default/chapter/29/13#Start-the-scheduler-as-a-Linux-service-%28upstart%29 SQLite locking is the most probable cause. The fastest way is to see what's happening is starting the scheduler with debug logging web2py.py -K appname -D 0 -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/u_PgzKLuQmw/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: flash after callback
Solved it myself. The target should be ':eval' like this: in the view: {{=A('func', callback('func'), target=':eval')}} in the controller: def func(): return 'jQuery(.flash).html(test).slideDown().delay(1000).slideUp();' On Tuesday, March 26, 2013 10:55:23 AM UTC+1, Serbitar wrote: Hi folks, I am trying to do a session.flash after a function is called via A('func', callback('func')). A simple session.flash in the callback function like: def func(): session.flash('test') return dict() is not working. I found an old thread that suggests: def func(): return 'jQuery(.flash).html(test).slideDown().delay(1000).slideUp();' and I think in the view I would have to add: {{=A('func', callback('func'), target='t')}} div id=t/div but that does not work. Nothing is shown. Any ideas? -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid 'headers' doesn't change column header
Can you write a code example? SQLFORM constructor has 'labels' parameter, but SQLFORM.grid doesn't have it. On Tuesday, March 26, 2013 12:20:10 PM UTC+2, Niphlod wrote: the form has normally the label of that field . headers are for the table representation only On Tuesday, March 26, 2013 11:01:03 AM UTC+1, Andrii Pitukh wrote: I created the following form: SQLFORM.grid(dbm.groups_subjects, headers={'table1.field1':T('Myname1')) The names of columns that are set in headers are shown correctly (I see * Myname1* as header). But when I press view or create, I see '*field1*' as column header instead of *'Myname1'* -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid 'headers' doesn't change column header
SQLFORM.grid takes the labels from the underlying model, so as long as you specify the label before calling the grid, you're fine. db.table1.field1.label = 'whatever' grid = SQLFORM.grid(db.table1) should work. On Tuesday, March 26, 2013 12:07:29 PM UTC+1, Andrii Pitukh wrote: Can you write a code example? SQLFORM constructor has 'labels' parameter, but SQLFORM.grid doesn't have it. On Tuesday, March 26, 2013 12:20:10 PM UTC+2, Niphlod wrote: the form has normally the label of that field . headers are for the table representation only On Tuesday, March 26, 2013 11:01:03 AM UTC+1, Andrii Pitukh wrote: I created the following form: SQLFORM.grid(dbm.groups_subjects, headers={'table1.field1':T('Myname1')) The names of columns that are set in headers are shown correctly (I see *Myname1* as header). But when I press view or create, I see '*field1*' as column header instead of *'Myname1'* -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
with the default logging.conf the timestamp is present as in all other web2py-related logging PS: are you sure that the worker is not killed/restarted by any chance (see the worker_name in the scheduler_run table) On Tuesday, March 26, 2013 11:33:53 AM UTC+1, Paolo valleri wrote: I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod nip...@gmail.com javascript: On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy processing the task and the underlying thread reaches the let's assign tasks loop, the logic will be skipped (it's unuseful to assign tasks if a worker is already processing them). So it can happen that even if the assignment time has come, if the worker is processing tasks it will skip the assignment Actually I have just seen the stop time, on average the task completes it cycle in just a few seconds (~1-2). Given that, is what you have suggested still valid? Nope. As I said it guaranteed that even in the case that the assignment loop falls into the timeframe of a RUNNING task, at the next round it will be picked up Last but not least, demo1 has gone in timeout after one successful cycle, this is very odd, How I can debug the scheduler application and find its errors? I am running scheduler as a linux service, as described here: http://web2py.com/books/**default/chapter/29/13#Start-** the-scheduler-as-a-Linux-**service-%28upstart%29http://web2py.com/books/default/chapter/29/13#Start-the-scheduler-as-a-Linux-service-%28upstart%29 SQLite locking is the most probable cause. The fastest way is to see what's happening is starting the scheduler with debug logging web2py.py -K appname -D 0 -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/u_PgzKLuQmw/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Cannot submit SQLFORM :/
Hi Folks, So I cannot submit SQLFORM, even the simpler ones like the following. I always get the else: that says please fill the form I checked and it seems the code is alright and i can submit forms and add content using the badmin plugin, so i'm kind of lost here. And another question, how can we pre-populate the upload field with request.vars ? in models.py db.define_table('t_asd', Field('id','id'), Field('f_app',type='string', default='abc',label=T('Parent App'),comment=T('The application or addon that will load this.')) ) in controller.py @auth.requires_login() def register_addon3(): form = SQLFORM(db.t_asd) if form.process().accepted: print(Addon added, waiting for moderator approval to show on the addon store.) response.flash = 'Addon added, waiting for moderator approval to show on the addon store.' elif form.errors: print(form has errors.) response.flash = 'form has errors' else: print(please fill the form.) response.flash = 'please fill the form' return dict(form=form) -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
When yesterday I saw demo1 in timeout with ps auxf I have seen that a new process was created. For this reason I started to debug scheduler and I asked how to log etc. Moreover, I restarted the scheduler manually so I am not able to understand if the other different names are for an internal problem or something different. Do you think that should be fixed by using a different db engine? Paolo On Tuesday, March 26, 2013 12:42:14 PM UTC+1, Niphlod wrote: with the default logging.conf the timestamp is present as in all other web2py-related logging PS: are you sure that the worker is not killed/restarted by any chance (see the worker_name in the scheduler_run table) On Tuesday, March 26, 2013 11:33:53 AM UTC+1, Paolo valleri wrote: I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod nip...@gmail.com On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy processing the task and the underlying thread reaches the let's assign tasks loop, the logic will be skipped (it's unuseful to assign tasks if a worker is already processing them). So it can happen that even if the assignment time has come, if the worker is processing tasks it will skip the assignment Actually I have just seen the stop time, on average the task completes it cycle in just a few seconds (~1-2). Given that, is what you have suggested still valid? Nope. As I said it guaranteed that even in the case that the assignment loop falls into the timeframe of a RUNNING task, at the next round it will be picked up Last but not least, demo1 has gone in timeout after one successful cycle, this is very odd, How I can debug the scheduler application and find its errors? I am running scheduler as a linux service, as described here: http://web2py.com/books/**default/chapter/29/13#Start-** the-scheduler-as-a-Linux-**service-%28upstart%29http://web2py.com/books/default/chapter/29/13#Start-the-scheduler-as-a-Linux-service-%28upstart%29 SQLite locking is the most probable cause. The fastest way is to see what's happening is starting the scheduler with debug logging web2py.py -K appname -D 0 -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/u_PgzKLuQmw/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
I find hard to believe that with a single worker, with that function that basically just prints something and an execution every 300 seconds the problem lies into a lock, unless the SQLite library available on your system is reallly old. On Tuesday, March 26, 2013 2:21:21 PM UTC+1, Paolo valleri wrote: When yesterday I saw demo1 in timeout with ps auxf I have seen that a new process was created. For this reason I started to debug scheduler and I asked how to log etc. Moreover, I restarted the scheduler manually so I am not able to understand if the other different names are for an internal problem or something different. Do you think that should be fixed by using a different db engine? Paolo On Tuesday, March 26, 2013 12:42:14 PM UTC+1, Niphlod wrote: with the default logging.conf the timestamp is present as in all other web2py-related logging PS: are you sure that the worker is not killed/restarted by any chance (see the worker_name in the scheduler_run table) On Tuesday, March 26, 2013 11:33:53 AM UTC+1, Paolo valleri wrote: I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod nip...@gmail.com On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy processing the task and the underlying thread reaches the let's assign tasks loop, the logic will be skipped (it's unuseful to assign tasks if a worker is already processing them). So it can happen that even if the assignment time has come, if the worker is processing tasks it will skip the assignment Actually I have just seen the stop time, on average the task completes it cycle in just a few seconds (~1-2). Given that, is what you have suggested still valid? Nope. As I said it guaranteed that even in the case that the assignment loop falls into the timeframe of a RUNNING task, at the next round it will be picked up Last but not least, demo1 has gone in timeout after one successful cycle, this is very odd, How I can debug the scheduler application and find its errors? I am running scheduler as a linux service, as described here: http://web2py.com/books/**default/chapter/29/13#Start-** the-scheduler-as-a-Linux-**service-%28upstart%29http://web2py.com/books/default/chapter/29/13#Start-the-scheduler-as-a-Linux-service-%28upstart%29 SQLite locking is the most probable cause. The fastest way is to see what's happening is starting the scheduler with debug logging web2py.py -K appname -D 0 -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/u_PgzKLuQmw/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
import sqlite3 print sqlite3.version 2.6.0 print sqlite3.sqlite_version 3.7.9 But, if the db lock is not the problem, the test application is very easy, where is it supposed to be the problem? On Tuesday, March 26, 2013 2:32:50 PM UTC+1, Niphlod wrote: I find hard to believe that with a single worker, with that function that basically just prints something and an execution every 300 seconds the problem lies into a lock, unless the SQLite library available on your system is reallly old. On Tuesday, March 26, 2013 2:21:21 PM UTC+1, Paolo valleri wrote: When yesterday I saw demo1 in timeout with ps auxf I have seen that a new process was created. For this reason I started to debug scheduler and I asked how to log etc. Moreover, I restarted the scheduler manually so I am not able to understand if the other different names are for an internal problem or something different. Do you think that should be fixed by using a different db engine? Paolo On Tuesday, March 26, 2013 12:42:14 PM UTC+1, Niphlod wrote: with the default logging.conf the timestamp is present as in all other web2py-related logging PS: are you sure that the worker is not killed/restarted by any chance (see the worker_name in the scheduler_run table) On Tuesday, March 26, 2013 11:33:53 AM UTC+1, Paolo valleri wrote: I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod nip...@gmail.com On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy processing the task and the underlying thread reaches the let's assign tasks loop, the logic will be skipped (it's unuseful to assign tasks if a worker is already processing them). So it can happen that even if the assignment time has come, if the worker is processing tasks it will skip the assignment Actually I have just seen the stop time, on average the task completes it cycle in just a few seconds (~1-2). Given that, is what you have suggested still valid? Nope. As I said it guaranteed that even in the case that the assignment loop falls into the timeframe of a RUNNING task, at the next round it will be picked up Last but not least, demo1 has gone in timeout after one successful cycle, this is very odd, How I can debug the scheduler application and find its errors? I am running scheduler as a linux service, as described here: http://web2py.com/books/**default/chapter/29/13#Start-** the-scheduler-as-a-Linux-**service-%28upstart%29http://web2py.com/books/default/chapter/29/13#Start-the-scheduler-as-a-Linux-service-%28upstart%29 SQLite locking is the most probable cause. The fastest way is to see what's happening is starting the scheduler with debug logging web2py.py -K appname -D 0 -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/u_PgzKLuQmw/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Sitemap Plugin or Sitemap Generator
Thanks james I did it exactly the other way around I made a list of funktions which are allowed to show ^^. It works pretty great except that all static(without an id) funktions show up twice. do you have the same problem? I'm sure its easy to fix I will do it once I finished the more pressing matters :) On Tuesday, March 26, 2013 7:58:49 AM UTC+1, James Burke wrote: Thanks so much for this code, it's really helpful. @BlueShadow - I keep my auth functions in a separate controller i.e. admin.py and can simply exclude this function from the list like so: if 'admin.py' in ctls: ctls.remove('admin.py') If you have functions in default.py that you wish to exclude you can create a list and have these items excluded in the loop, like so: exclusions = ['user','unsubscribe'] for ctl in ctls: if ctl.endswith(.bak) == False: filename = os.path.join(ctldir,ctl) data = open(filename, 'r').read() functions = regex_expose.findall(data) ctl = ctl[:-3].replace(_, ) for f in functions: if not any(f in s for s in exclusions): # if function is not in exclustions sitemap.append(TAG.url(TAG.loc(' http://www.leandro.inf.br/%s/%s/%s' % (request.application,ctl,f.replace( _, ) Not sure why your deleted function is appearing, the code dynamically generates the sitemap on request. I hope that helps. -James On Monday, March 25, 2013 1:06:14 AM UTC+13, BlueShadow wrote: This Sitemap generator is great! But I got a couple questions about it.can you remove all entries which require authorisation? I tried it for one of my applications and it shows an entry for a long deleted function(the view has been deleted too). why is that happening? -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How can I receive oauth/access tokens with the Oauth library in Web2py?
Yesterday, I wanted to get the tokens from Facebook and Twitter for users and using the Web2py normal login system at same time. I only wanted to use their APIs not for implementing oauth login into my website. I was able to get tokens from Facebook API by using Facebook JavaScript SDK. I chose this route since I don't know how to separate the Web2py given library(login_form) for getting only tokens instead of creating auth users and signing in. If I can separate the login_form, how should I do it? Or is there any other way around? Thank you! -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Web2Py support on roadmap for pycharm 3
awesome :) desperately waiting for a good IDE with web2py support. what are currently the best options for debugging web2py applications? I'm using Komodo Edit which is quite nice - is it possible to easily debug a web2py application with Komodo IDE? Wing IDE seems to support debugging but the GUI looks really outdated so I'm a little afraid to use it. Eclipse is very resource intensive, I don't think it's a good option for python development for me. Are there any other alternatives? what IDE would you recommend? -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Cannot submit SQLFORM :/
Can we see the view? Regarding pre-populating an upload field, what do you mean? Do you want to provide a default file, or do you somehow want to identify a file on the user's machine? Anthony On Tuesday, March 26, 2013 9:07:43 AM UTC-4, smoggy wrote: Hi Folks, So I cannot submit SQLFORM, even the simpler ones like the following. I always get the else: that says please fill the form I checked and it seems the code is alright and i can submit forms and add content using the badmin plugin, so i'm kind of lost here. And another question, how can we pre-populate the upload field with request.vars ? in models.py db.define_table('t_asd', Field('id','id'), Field('f_app',type='string', default='abc',label=T('Parent App'),comment=T('The application or addon that will load this.')) ) in controller.py @auth.requires_login() def register_addon3(): form = SQLFORM(db.t_asd) if form.process().accepted: print(Addon added, waiting for moderator approval to show on the addon store.) response.flash = 'Addon added, waiting for moderator approval to show on the addon store.' elif form.errors: print(form has errors.) response.flash = 'form has errors' else: print(please fill the form.) response.flash = 'please fill the form' return dict(form=form) -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: style input class=upload the Boostrap way
If you just needed to alter that one widget, then use a custom widget, as Niphlod suggests. Customizing the widget affects only the input element, not the label, comment, etc. Anthony On Sunday, March 24, 2013 4:17:04 AM UTC-4, Annet wrote: I am looking for a way to style this: input type=file name=file id=heroUnitFile_file class=upload more in line with the Bootstrap styling of the input and button style, as described in the buttons instead of text section of http://twitter.github.com/bootstrap/base-css.html#forms Kind regards, Annet -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] [Newbie]How to query and display table records defined in db.py in pages of auth.wiki()
Hi there, I've going through the web2py group trying various keywords but didn't find a clear answer: in the pages of auth.wiki, how can I query and display tables defined in db.py? Or, more importantly is this possible. Accordingly to the introduction of auth.wiki it sounds like a Swiss knife that handles a lot of needs, so I believe there is a simple way out. It would be wonderful if it can be achieved with Markmin just embedding youtube video. Any reply appreciated. Spring -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] bootswatch : bootstrap.css replace what file
hi, i'm trying to change the web2py default layout with bootstrap.min.css download from http://bootswatch.com. is web2py use bootswatch file too? and how about bootstrap.css file, because when i download and replace it with web2py_bootstrap.css my layout is chaos? any hints or suggestions about this? thank you very much before -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: non-wiki-editor sees [wiki] dropdown menu
How to hide *[wiki]* from non-wiki-editor users in my case? I guess by now you can test auth methods to know if the logged in user has the required permission and conditionally return another menu. # controller # I'd use auth.has_membership(role=allowed_group) if auth.test if user is allowed: return auth.wiki() else: return dict(message=Sorry. The wiki is no available) Enabling/disabling menus is a todo for the wiki feature and is related to the pending wiki.settings implementation (in roadmap). -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: bootswatch : bootstrap.css replace what file
Replace existing yourapp/static/css/bootstrap.min.css with the bootstrap.min.css file from bootswatch.com. Keep web2py_bootstrap.css as it is, as this file is web2py specific and does not come from either Bootstrap or Bootswatch. Note that web2py is still at Bootstrap 2.2.2 at the moment, although going to 2.3.1 shouldn't be a problem. If you want to upgrade, you should also replace yourapp/static/css/bootstrap-responsive.min.css and yourapp/static/js/bootstrap.min.js with corresponding files from Bootstrap 2.3.1. Regards, Ales On Tuesday, March 26, 2013 3:35:10 PM UTC+1, 黄祥 wrote: hi, i'm trying to change the web2py default layout with bootstrap.min.css download from http://bootswatch.com. is web2py use bootswatch file too? and how about bootstrap.css file, because when i download and replace it with web2py_bootstrap.css my layout is chaos? any hints or suggestions about this? thank you very much before -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How can I receive oauth/access tokens with the Oauth library in Web2py?
I was able to manage this issue. Tweepy was the one I used and used redirect to get tokens from callback. I guess it's better to leave login_form function as is. :) Have a nice day! On Tuesday, March 26, 2013 8:51:09 AM UTC-5, Kenny wrote: Yesterday, I wanted to get the tokens from Facebook and Twitter for users and using the Web2py normal login system at same time. I only wanted to use their APIs not for implementing oauth login into my website. I was able to get tokens from Facebook API by using Facebook JavaScript SDK. I chose this route since I don't know how to separate the Web2py given library(login_form) for getting only tokens instead of creating auth users and signing in. If I can separate the login_form, how should I do it? Or is there any other way around? Thank you! -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Edit only specific fields from a Table
I have extended the auth_user table with an extra field: auth.settings.extra_fields['auth_user']=[ Field('isactive','boolean', default =True, readable=False, writable= False), ] And I would like a web page listing only specific fields: def lab_managers(): dba = db.auth_user dba.islm.readable=dba.islm.writable=True grid=SQLFORM.grid((dba.isactive==True), fields=[dba.username, dba.isactive], deletable=False, onvalidation=enter_user ) return dict(grid=grid) where enter_user is a function checking and entering a user in respect to Ldap directories. Now, I would like the 'Add' and the 'Edit' functions to present to the user only the 2 fields 'username' and 'isactive'. Not all the Fields of the auth_user table. Is this possible? -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Web2Py support on roadmap for pycharm 3
http://confluence.jetbrains.com/display/PYH/PyCharm+3.0+Roadmap Planned release date: Autumn 2013 -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
If can be useful, I attached part of the log file in which demo1 is executed. First execution: 2013-03-26 15:52:31 second execution: 2013-03-26 15:58:55 (+384s) Paolo 2013/3/26 Paolo valleri paolo.vall...@gmail.com import sqlite3 print sqlite3.version 2.6.0 print sqlite3.sqlite_version 3.7.9 But, if the db lock is not the problem, the test application is very easy, where is it supposed to be the problem? On Tuesday, March 26, 2013 2:32:50 PM UTC+1, Niphlod wrote: I find hard to believe that with a single worker, with that function that basically just prints something and an execution every 300 seconds the problem lies into a lock, unless the SQLite library available on your system is reallly old. On Tuesday, March 26, 2013 2:21:21 PM UTC+1, Paolo valleri wrote: When yesterday I saw demo1 in timeout with ps auxf I have seen that a new process was created. For this reason I started to debug scheduler and I asked how to log etc. Moreover, I restarted the scheduler manually so I am not able to understand if the other different names are for an internal problem or something different. Do you think that should be fixed by using a different db engine? Paolo On Tuesday, March 26, 2013 12:42:14 PM UTC+1, Niphlod wrote: with the default logging.conf the timestamp is present as in all other web2py-related logging PS: are you sure that the worker is not killed/restarted by any chance (see the worker_name in the scheduler_run table) On Tuesday, March 26, 2013 11:33:53 AM UTC+1, Paolo valleri wrote: I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod nip...@gmail.com On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy processing the task and the underlying thread reaches the let's assign tasks loop, the logic will be skipped (it's unuseful to assign tasks if a worker is already processing them). So it can happen that even if the assignment time has come, if the worker is processing tasks it will skip the assignment Actually I have just seen the stop time, on average the task completes it cycle in just a few seconds (~1-2). Given that, is what you have suggested still valid? Nope. As I said it guaranteed that even in the case that the assignment loop falls into the timeframe of a RUNNING task, at the next round it will be picked up Last but not least, demo1 has gone in timeout after one successful cycle, this is very odd, How I can debug the scheduler application and find its errors? I am running scheduler as a linux service, as described here: http://web2py.com/books/**defaul**t/chapter/29/13#Start-**the-** scheduler-as-a-Linux-**service-%**28upstart%29http://web2py.com/books/default/chapter/29/13#Start-the-scheduler-as-a-Linux-service-%28upstart%29 SQLite locking is the most probable cause. The fastest way is to see what's happening is starting the scheduler with debug logging web2py.py -K appname -D 0 -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/u_PgzKLuQmw/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/u_PgzKLuQmw/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/u_PgzKLuQmw/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] how about setting a standard fadeout to response.flash?
Hi Had a user pointing out how irritating it was that the response.flash never goes away automatically. Found this fix thou in the group, how about making a standard 4 second fadeout on it? in web2py.js: var flashBox = jQuery(.flash), flashTimer; flashBox.click(function(){ if (flashTimer) clearTimeout(flashTimer); flashBox.fadeOut(400, function(){jQuery(.flash).html('')}); }); flashTimer = setTimeout(function(){flashBox.fadeOut(400, function(){jQuery (.flash).html('')});}, 4000); -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: [Newbie]How to query and display table records defined in db.py in pages of auth.wiki()
I've going through the web2py group trying various keywords but didn't find a clear answer: in the pages of auth.wiki, how can I query and display tables defined in db.py? Or, more importantly is this possible. Accordingly to the introduction of auth.wiki it sounds like a Swiss knife that handles a lot of needs, so I believe there is a simple way out. It would be wonderful if it can be achieved with Markmin just embedding youtube video. AFAIK, there's no support for simple db queries within markmin code. This can be achieved by using custom markup and using the extra MARKMIN function argument as documented in the book (in The Views), but it would require building a custom wiki without the auth.wiki shortcut, and overriding the class markmin parser or a similar workaround. I think this will be suported after adding the wiki settings feature, as noted in another post (in roadmap). -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] web2py, mod_proxy and redirection
Hi, I'm having problems with apache config of web2py. I'm trying to run a test server (which others can work against) and a dev server off the same apache server. Perhaps this is a little crazy, but that's how we're set up now. From the external pov, I'm trying to configure my server such that hostname/ goes to the test server and hostname/dev goes to the dev server I have the test server and the dev server installed as two seperate web2py instances. My problem relates to the dev server and login based redirection. When I go to https://hostname/dev/admin I'm presented with a login form, but the send parameter on the login points to /admin and not /dev/admin. More specifically, https://hostname/dev/admin/default/index?send=%2Fadmin%2Fdefault%2Flogin Hence the client tries to load hostname/admin/default/login (and not the dev version) on login. Do I need to do anything specific with mod_proxy to catch this? Thanks and rgds, Seán. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Settings and messages when on_login and log_out
In my application I have the following setting in db.py: auth.settings.logout_onlogout = lambda user: on_logout(auth,session) auth.settings.logout_next=URL('cms','index') on_logout(auth,session) is a function in a module which amongst others contains the following line of code: auth.messages.logged_out='Succesvol uitgelogd, tot ziens %s' %(name) This works well, the message is being displayed in a flash at cms/index I tried something similar on login in db.py: auth.settings.login_onlogin = lambda user: on_login(auth,session) auth.settings.login_next=URL('cms','index') However, auth.settings.login_onlogin, isn't a setting in web2py. I changed this line to: auth.settings.login_onaccept= lambda user: URL('cms','on_login') I do no longer get the error but cms/onlogin isn't being executed. I get cms/index with a flash message: Logged in. When i remove the setting: auth.settings.login_onlogin = lambda user: on_login(auth,session) and change auth.settings.login_next=URL('cms','index') to auth.settings.login_next=URL('cms','on_login') and in cms/on_login to cms/index, on_login is being executed but the message isn't being displayed. def on_login(): if auth.has_membership(ADMIN): admin_menu() session.memberships=[] else: session.memberships=db(db.auth_membership.user_id==auth.user.id).select(db.auth_membership.group_id).as_list() standard_menu(auth.user.nodeID) auth.messages.logged_in='Succesvol ingelogd, welkom %s' %(name) session.alert='alert-success' redirect(URL('index')) When I change auth.messages.logged_in='Succesvol ingelogd, welkom %s' %(name) to session.flash='Succesvol ingelogd, welkom %s' %(name) The message is being displayed correctly. However, after a session has expired an the user logs in again, the message is Logged in, so in this case on_login is bypassed. Why is logging in different from logging out? Kind regards, Annet -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: web2py, mod_proxy and redirection
well, the underlying problem with this architecture is that on / apache rewrites internally from /whatever/whatever2 to /whatever/whatever2 on the default instance. From this standpoint, the default behaviour of web2py is tuned accordingly to what apache is doing. On /dev/ apache rewrites internally /dev/whatever/whatever2 to (I suspect) /whatever/whatever2 on the dev instance. But, web2py doesn't know that apache has done an internal rewrite, and apache doesn't rewrite outcoming urls accordingly . Unless you play a lot with rewritecond or proxypassreverse, the better way is informing web2py in advance that every /whatever/whatever2 url needs to be outputted as /dev/whatever/whatever2 , so you get a consistent behaviour client-side you have to play with your routes.py on the dev instance to make it behave accordingly to what apache is doing. On Tuesday, March 26, 2013 4:41:37 PM UTC+1, Sean Murphy wrote: Hi, I'm having problems with apache config of web2py. I'm trying to run a test server (which others can work against) and a dev server off the same apache server. Perhaps this is a little crazy, but that's how we're set up now. From the external pov, I'm trying to configure my server such that hostname/ goes to the test server and hostname/dev goes to the dev server I have the test server and the dev server installed as two seperate web2py instances. My problem relates to the dev server and login based redirection. When I go to https://hostname/dev/admin I'm presented with a login form, but the send parameter on the login points to /admin and not /dev/admin. More specifically, https://hostname/dev/admin/default/index?send=%2Fadmin%2Fdefault%2Flogin Hence the client tries to load hostname/admin/default/login (and not the dev version) on login. Do I need to do anything specific with mod_proxy to catch this? Thanks and rgds, Seán. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: [Newbie]How to query and display table records defined in db.py in pages of auth.wiki()
though the current recommended way is to code such views on a different controller and embed those views as components http://web2py.com/books/default/chapter/29/03?search=wiki#Components On Tuesday, March 26, 2013 4:40:17 PM UTC+1, Alan Etkin wrote: I've going through the web2py group trying various keywords but didn't find a clear answer: in the pages of auth.wiki, how can I query and display tables defined in db.py? Or, more importantly is this possible. Accordingly to the introduction of auth.wiki it sounds like a Swiss knife that handles a lot of needs, so I believe there is a simple way out. It would be wonderful if it can be achieved with Markmin just embedding youtube video. AFAIK, there's no support for simple db queries within markmin code. This can be achieved by using custom markup and using the extra MARKMIN function argument as documented in the book (in The Views), but it would require building a custom wiki without the auth.wiki shortcut, and overriding the class markmin parser or a similar workaround. I think this will be suported after adding the wiki settings feature, as noted in another post (in roadmap). -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: how about setting a standard fadeout to response.flash?
we should add some features to the standard flash message there are some messages that are good to behave as sticky (click ensures the message is read by the user) and some that are niceties that can fade out . We should only agree on which features use and what variables use as a standard. I'm adding it to the roadmap but feel free to fiel a bug on googlecode pointing to this thread. On Tuesday, March 26, 2013 4:36:43 PM UTC+1, Mika Sjöman wrote: Hi Had a user pointing out how irritating it was that the response.flash never goes away automatically. Found this fix thou in the group, how about making a standard 4 second fadeout on it? in web2py.js: var flashBox = jQuery(.flash), flashTimer; flashBox.click(function(){ if (flashTimer) clearTimeout(flashTimer); flashBox.fadeOut(400, function(){jQuery(.flash).html('')}); }); flashTimer = setTimeout(function(){flashBox.fadeOut(400, function(){ jQuery(.flash).html('')});}, 4000); -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] facebook connect
hi, i want to implement 2 kind of login on my app. 1) basic auth 2) facebook connect i extended auth_user auth.settings.extra_fields['auth_user']= [ Field('ballance', type='double', default=0, writable=False, readable=False), Field('image', type='string'), Field('phone', type='integer'), Field('birthday', type='date')] auth.define_tables(username=True, signature=False) i want when user connect with facebook to insert in auth_user new record with facebook data (firstname, lastname, birthday, profile picture .) do you have a working example? what is the best practice? -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: [Newbie]How to query and display table records defined in db.py in pages of auth.wiki()
Thanks for explaining. 在 2013年3月26日星期二UTC+8下午10时33分05秒,Spring写道: Hi there, I've going through the web2py group trying various keywords but didn't find a clear answer: in the pages of auth.wiki, how can I query and display tables defined in db.py? Or, more importantly is this possible. Accordingly to the introduction of auth.wiki it sounds like a Swiss knife that handles a lot of needs, so I believe there is a simple way out. It would be wonderful if it can be achieved with Markmin just embedding youtube video. Any reply appreciated. Spring -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: how about setting a standard fadeout to response.flash?
I prefer to keep web2py.js stock, to ease updates, so I add a similar fadeout js to layout.html when I need it. I'm not sure I'd alter the default though. App user can miss a message that fades out quickly, so I prefer to leave such decisions to the UI designer. We have apps that have flash messages with a fixed timeout (4-8 sec if I remember correctly), apps that have flash messages with no time out at all and apps entirely without flash messages. All this is a valid design approach and I see no benefit to changing the default, since one solution will never fit all usage cases. Perhaps it would benefit web2py users if fadeout was pre-set in code as a variable (ie. off or value in seconds)? It would be easier to hack the setting. But then again, web2py is a programming framework. web2py users are expected to know how to alter such things or at least search trough the docs and google groups. I like the idea of having flash messages with different categories (ie. error, warning, info), which could be treated differently (sticky, fadeout, different graphical design etc.). But isn't this pushing it too far..? I mean, isn't it getting too complex? It does sound like a nice idea, though... Regards, Ales On Tuesday, March 26, 2013 4:36:43 PM UTC+1, Mika Sjöman wrote: Hi Had a user pointing out how irritating it was that the response.flash never goes away automatically. Found this fix thou in the group, how about making a standard 4 second fadeout on it? in web2py.js: var flashBox = jQuery(.flash), flashTimer; flashBox.click(function(){ if (flashTimer) clearTimeout(flashTimer); flashBox.fadeOut(400, function(){jQuery(.flash).html('')}); }); flashTimer = setTimeout(function(){flashBox.fadeOut(400, function(){ jQuery(.flash).html('')});}, 4000); -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
whoa. seems that something wrong is happening trying to assing new tasks normally, every web2py.scheduler.mapserver#7791 - INFO - TICKER: I'm a ticker should be followed closely by the lines web2py.scheduler.mapserver#7791 - INFO - TICKER: workers are 1 web2py.scheduler.mapserver#7791 - INFO - TICKER: tasks are 0 While in your case for several times those lines are not present The fact is that the assignment is wrapped yet in a try except clause and every exception should be logged as well, but your log doesn't show anything of that. I can add more debug lines to the scheduler but this didn't ever happen on all my platforms, so without reproducing it I'm a little bit unsure what the fix can be. On Tuesday, March 26, 2013 4:26:11 PM UTC+1, Paolo valleri wrote: the flle! sorry... Paolo 2013/3/26 paolo@gmail.com javascript: paolo@gmail.comjavascript: If can be useful, I attached part of the log file in which demo1 is executed. First execution: 2013-03-26 15:52:31 second execution: 2013-03-26 15:58:55 (+384s) Paolo 2013/3/26 Paolo valleri paolo@gmail.com javascript: import sqlite3 print sqlite3.version 2.6.0 print sqlite3.sqlite_version 3.7.9 But, if the db lock is not the problem, the test application is very easy, where is it supposed to be the problem? On Tuesday, March 26, 2013 2:32:50 PM UTC+1, Niphlod wrote: I find hard to believe that with a single worker, with that function that basically just prints something and an execution every 300 seconds the problem lies into a lock, unless the SQLite library available on your system is reallly old. On Tuesday, March 26, 2013 2:21:21 PM UTC+1, Paolo valleri wrote: When yesterday I saw demo1 in timeout with ps auxf I have seen that a new process was created. For this reason I started to debug scheduler and I asked how to log etc. Moreover, I restarted the scheduler manually so I am not able to understand if the other different names are for an internal problem or something different. Do you think that should be fixed by using a different db engine? Paolo On Tuesday, March 26, 2013 12:42:14 PM UTC+1, Niphlod wrote: with the default logging.conf the timestamp is present as in all other web2py-related logging PS: are you sure that the worker is not killed/restarted by any chance (see the worker_name in the scheduler_run table) On Tuesday, March 26, 2013 11:33:53 AM UTC+1, Paolo valleri wrote: I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod nip...@gmail.com On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy processing the task and the underlying thread reaches the let's assign tasks loop, the logic will be skipped (it's unuseful to assign tasks if a worker is already processing them). So it can happen that even if the assignment time has come, if the worker is processing tasks it will skip the assignment Actually I have just seen the stop time, on average the task completes it cycle in just a few seconds (~1-2). Given that, is what you have suggested still valid? Nope. As I said it guaranteed that even in the case that the assignment loop falls into the timeframe of a RUNNING task, at the next round it will be picked up Last but not least, demo1 has gone in timeout after one successful cycle, this is very odd, How I can debug the scheduler application and find its errors? I am running scheduler as a linux service, as described here: http://web2py.com/books/**defaul**t/chapter/29/13#Start-**the-** scheduler-as-a-Linux-**service-%**28upstart%29http://web2py.com/books/default/chapter/29/13#Start-the-scheduler-as-a-Linux-service-%28upstart%29 SQLite locking is the most probable cause. The fastest way is to see what's happening is starting the scheduler with debug logging web2py.py -K appname -D 0 -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/* *topic/web2py/u_PgzKLuQmw/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/u_PgzKLuQmw/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to
[web2py] strange mobile behaviour when changing bootstrap theme
Hi I am trying to change the theme to the Cerulean theme at bootswatch.com. But changing from the default to bootstrap.min.css makes the web2py main menu go away when on mobile phone. Should I add / change anything else to make it work on mobile? Cheers -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: strange mobile behaviour when changing bootstrap theme
Did you use Bootswatch compatible with the Bootstrap 2.2.2 version? web2py is still at Bootstrap 2.2.2 ATM. Older Bootswatch versions are available for download from their site. Or you could update the rest of the Bootstrap included with web2py to 2.3.1 and see if this also solves the issue. Anyway, I suggest making sure Bootstrap and Bootswatch are on the same version before troubleshooting further. I find the main menu behaviour a bit flaky on mobile when deep submenus are used. So your problem might be related to something else, not just conflicting lib versions. Regards, Ales On Tuesday, March 26, 2013 6:18:59 PM UTC+1, Mika Sjöman wrote: Hi I am trying to change the theme to the Cerulean theme at bootswatch.com. But changing from the default to bootstrap.min.css makes the web2py main menu go away when on mobile phone. Should I add / change anything else to make it work on mobile? Cheers -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Cannot submit SQLFORM :/
There is no view, it's rendered from the controller. About the upload, i'm sending in request.vars the location of the file to upload, so the user does not have to input it manually. This is being called from a backoffice program that will upload : an icon, a zip and a screenshot, so this upload form filling is very convenient. Terça-feira, 26 de Março de 2013 14:02:47 UTC, Anthony escreveu: Can we see the view? Regarding pre-populating an upload field, what do you mean? Do you want to provide a default file, or do you somehow want to identify a file on the user's machine? Anthony On Tuesday, March 26, 2013 9:07:43 AM UTC-4, smoggy wrote: Hi Folks, So I cannot submit SQLFORM, even the simpler ones like the following. I always get the else: that says please fill the form I checked and it seems the code is alright and i can submit forms and add content using the badmin plugin, so i'm kind of lost here. And another question, how can we pre-populate the upload field with request.vars ? in models.py db.define_table('t_asd', Field('id','id'), Field('f_app',type='string', default='abc',label=T('Parent App'),comment=T('The application or addon that will load this.')) ) in controller.py @auth.requires_login() def register_addon3(): form = SQLFORM(db.t_asd) if form.process().accepted: print(Addon added, waiting for moderator approval to show on the addon store.) response.flash = 'Addon added, waiting for moderator approval to show on the addon store.' elif form.errors: print(form has errors.) response.flash = 'form has errors' else: print(please fill the form.) response.flash = 'please fill the form' return dict(form=form) -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Populating jqGrid Tree with JSON
Where would one get this jqGrid Tree, and can you post a sample JSON dataset that this is supposed to work with? On Monday, March 25, 2013 3:51:10 PM UTC-7, Nate wrote: Nothing in the console. Firebug reports No Javascript on this pageIf script tags have a type attribute, it should equal text/javascript or application/javascript. Also scripts must be parsable (syntactically correct). On Monday, March 25, 2013 11:15:31 PM UTC+11, Willoughby wrote: Do you get any errors in the console? That's the first place I usually look... On Sunday, March 24, 2013 8:42:45 PM UTC-4, Nate wrote: Hi I have a controller sending JSON to my view. I cannot get the data into the TreeGrid. The Json is coming down correctly (I placed it manually and it works). Running this code places the JSON on the webpage. Controller and View below. Help appreciated. Regards Nate CONTROLLER @service.json def get_report(): import json rows = db(db.neighbourhood.id 0).select().as_list() concat = '{response:[' seq =1 for row in rows: row['id'] = seq concat = concat + json.dumps(row)+, seq = seq+1 innerrows = db(db.report.parent == row.get('id')).select().as_list() for innerrow in innerrows: innerrow['id'] = seq concat = concat + json.dumps(innerrow) + , seq = seq+1 concat = concat.strip( ',' ) concat = concat + ']},grid;' return concat VIEW {{extend 'layout.html'}} script type=text/javascript jQuery(document).ready(function(){ jQuery.getJSON({{=URL(r=request,f='call',args=['json','get_report'])}}, function(msg){ jQuery.each(msg, function(){ topicjson = this; $('#treeGrid').jqGrid({ datastr: topicjson, datatype: json, height: auto, mType: 'GET', treeGridModel: 'adjacency', colNames: [/*id,*/Items,url], colModel: [ {name: elementName, width:250, resizable: false}, {name: url,width:1,hidden:true} ], treeGrid: true, caption: Neighbourhood, ExpandColumn: name, ExpandColClick:true, autowidth: true }); }) }); }); /script div style=width:180px; table id=treeGrid /table -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Cannot submit SQLFORM :/
You can't auto-fill a location of a file to upload. Imagine the security holes that would open up on the web. No, users have to select the file on their system. On Tuesday, March 26, 2013 10:36:15 AM UTC-7, smoggy wrote: There is no view, it's rendered from the controller. About the upload, i'm sending in request.vars the location of the file to upload, so the user does not have to input it manually. This is being called from a backoffice program that will upload : an icon, a zip and a screenshot, so this upload form filling is very convenient. Terça-feira, 26 de Março de 2013 14:02:47 UTC, Anthony escreveu: Can we see the view? Regarding pre-populating an upload field, what do you mean? Do you want to provide a default file, or do you somehow want to identify a file on the user's machine? Anthony On Tuesday, March 26, 2013 9:07:43 AM UTC-4, smoggy wrote: Hi Folks, So I cannot submit SQLFORM, even the simpler ones like the following. I always get the else: that says please fill the form I checked and it seems the code is alright and i can submit forms and add content using the badmin plugin, so i'm kind of lost here. And another question, how can we pre-populate the upload field with request.vars ? in models.py db.define_table('t_asd', Field('id','id'), Field('f_app',type='string', default='abc',label=T('Parent App'),comment=T('The application or addon that will load this.')) ) in controller.py @auth.requires_login() def register_addon3(): form = SQLFORM(db.t_asd) if form.process().accepted: print(Addon added, waiting for moderator approval to show on the addon store.) response.flash = 'Addon added, waiting for moderator approval to show on the addon store.' elif form.errors: print(form has errors.) response.flash = 'form has errors' else: print(please fill the form.) response.flash = 'please fill the form' return dict(form=form) -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] DAL how to show only some of the lines in a db
Hi, In my website I want to put only 5 news in the page main page that are stored in a mongodb. Can anyone tell me how to do it? Thanks -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Cannot submit SQLFORM :/
Snif. Maybe when i get the time i play with QtWebkit to switch those fields automatically then :/ . As for the SQLForm problem, you got any clues ? why in badmin it works but every other sqlform does not. Terça-feira, 26 de Março de 2013 17:40:33 UTC, Derek escreveu: You can't auto-fill a location of a file to upload. Imagine the security holes that would open up on the web. No, users have to select the file on their system. On Tuesday, March 26, 2013 10:36:15 AM UTC-7, smoggy wrote: There is no view, it's rendered from the controller. About the upload, i'm sending in request.vars the location of the file to upload, so the user does not have to input it manually. This is being called from a backoffice program that will upload : an icon, a zip and a screenshot, so this upload form filling is very convenient. Terça-feira, 26 de Março de 2013 14:02:47 UTC, Anthony escreveu: Can we see the view? Regarding pre-populating an upload field, what do you mean? Do you want to provide a default file, or do you somehow want to identify a file on the user's machine? Anthony On Tuesday, March 26, 2013 9:07:43 AM UTC-4, smoggy wrote: Hi Folks, So I cannot submit SQLFORM, even the simpler ones like the following. I always get the else: that says please fill the form I checked and it seems the code is alright and i can submit forms and add content using the badmin plugin, so i'm kind of lost here. And another question, how can we pre-populate the upload field with request.vars ? in models.py db.define_table('t_asd', Field('id','id'), Field('f_app',type='string', default='abc',label=T('Parent App'),comment=T('The application or addon that will load this.')) ) in controller.py @auth.requires_login() def register_addon3(): form = SQLFORM(db.t_asd) if form.process().accepted: print(Addon added, waiting for moderator approval to show on the addon store.) response.flash = 'Addon added, waiting for moderator approval to show on the addon store.' elif form.errors: print(form has errors.) response.flash = 'form has errors' else: print(please fill the form.) response.flash = 'please fill the form' return dict(form=form) -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: DAL how to show only some of the lines in a db
http://web2py.com/books/default/chapter/29/06#orderby,-groupby,-limitby,-distinct,-having On Tuesday, March 26, 2013 2:00:36 PM UTC-4, Hugo Costa wrote: Hi, In my website I want to put only 5 news in the page main page that are stored in a mongodb. Can anyone tell me how to do it? Thanks -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] registration key?
What are the registration key and registration identifier fields in auth user sign up table? I'm new to web2py, so I apologize if the question looks silly. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
I can make few tests but only tomorrow, I will be out for the rest of the week. If you send me a patch with the new log statement, I will come back with the result asap. Paolo 2013/3/26 Niphlod niph...@gmail.com whoa. seems that something wrong is happening trying to assing new tasks normally, every web2py.scheduler.mapserver#7791 - INFO - TICKER: I'm a ticker should be followed closely by the lines web2py.scheduler.mapserver#7791 - INFO - TICKER: workers are 1 web2py.scheduler.mapserver#7791 - INFO - TICKER: tasks are 0 While in your case for several times those lines are not present The fact is that the assignment is wrapped yet in a try except clause and every exception should be logged as well, but your log doesn't show anything of that. I can add more debug lines to the scheduler but this didn't ever happen on all my platforms, so without reproducing it I'm a little bit unsure what the fix can be. On Tuesday, March 26, 2013 4:26:11 PM UTC+1, Paolo valleri wrote: the flle! sorry... Paolo 2013/3/26 paolo@gmail.com paolo@gmail.com If can be useful, I attached part of the log file in which demo1 is executed. First execution: 2013-03-26 15:52:31 second execution: 2013-03-26 15:58:55 (+384s) Paolo 2013/3/26 Paolo valleri paolo@gmail.com import sqlite3 print sqlite3.version 2.6.0 print sqlite3.sqlite_version 3.7.9 But, if the db lock is not the problem, the test application is very easy, where is it supposed to be the problem? On Tuesday, March 26, 2013 2:32:50 PM UTC+1, Niphlod wrote: I find hard to believe that with a single worker, with that function that basically just prints something and an execution every 300 seconds the problem lies into a lock, unless the SQLite library available on your system is reallly old. On Tuesday, March 26, 2013 2:21:21 PM UTC+1, Paolo valleri wrote: When yesterday I saw demo1 in timeout with ps auxf I have seen that a new process was created. For this reason I started to debug scheduler and I asked how to log etc. Moreover, I restarted the scheduler manually so I am not able to understand if the other different names are for an internal problem or something different. Do you think that should be fixed by using a different db engine? Paolo On Tuesday, March 26, 2013 12:42:14 PM UTC+1, Niphlod wrote: with the default logging.conf the timestamp is present as in all other web2py-related logging PS: are you sure that the worker is not killed/restarted by any chance (see the worker_name in the scheduler_run table) On Tuesday, March 26, 2013 11:33:53 AM UTC+1, Paolo valleri wrote: I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod nip...@gmail.com On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy processing the task and the underlying thread reaches the let's assign tasks loop, the logic will be skipped (it's unuseful to assign tasks if a worker is already processing them). So it can happen that even if the assignment time has come, if the worker is processing tasks it will skip the assignment Actually I have just seen the stop time, on average the task completes it cycle in just a few seconds (~1-2). Given that, is what you have suggested still valid? Nope. As I said it guaranteed that even in the case that the assignment loop falls into the timeframe of a RUNNING task, at the next round it will be picked up Last but not least, demo1 has gone in timeout after one successful cycle, this is very odd, How I can debug the scheduler application and find its errors? I am running scheduler as a linux service, as described here: http://web2py.com/books/**default/chapter/29/13#Start-**the-* *sche**duler-as-a-Linux-**service-%**28up**start%29http://web2py.com/books/default/chapter/29/13#Start-the-scheduler-as-a-Linux-service-%28upstart%29 SQLite locking is the most probable cause. The fastest way is to see what's happening is starting the scheduler with debug logging web2py.py -K appname -D 0 -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/
[web2py] Re: registration key?
What are the registration key and registration identifier fields in auth user sign up table? I'm new to web2py, so I apologize if the question looks silly. Both registration_key and registration_id are explained in the book: http://www.web2py.com/books/default/chapter/29/09 -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Image in web2py/MongoDB based blog
Hi! So, I'm setting up a website where there will be a blog system where I can create my news using a simple form and store that in a mongo database, but I want to know how can I put an image/video in the text making them appear in the view of the user. I tried using with HTML code but it didn't work. Can any one gimme a hand on this? Thanks, Hugo -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: DAL how to show only some of the lines in a db
Thanks! ;) Terça-feira, 26 de Março de 2013 18:10:47 UTC, Cliff Kachinske escreveu: http://web2py.com/books/default/chapter/29/06#orderby,-groupby,-limitby,-distinct,-having On Tuesday, March 26, 2013 2:00:36 PM UTC-4, Hugo Costa wrote: Hi, In my website I want to put only 5 news in the page main page that are stored in a mongodb. Can anyone tell me how to do it? Thanks -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] SQLForm.factory
Ok I guess I missed that but I get an error at the line if form.process().accepted: I changed my controler to this: def newImage(): dbtable = db.Images #uploads table name print newImage if len(request.args): records = db(dbtable.id==request.args[0]).select() if len(request.args) and len(records): form = SQLFORM(dbtable, records[0], deletable=True) else: form = SQLFORM.factory(dbtable,db.image_references) if form.process().accepted: print form accepts response.flash = 'Entry for Images Database accepted,start creating thumb' makeThumbnail(dbtable,form.vars.id,(200,200)) print thumbnail done id = db.Images.insert(**db.Images._filter_fields(form.vars)) print Image table written form.vars.client=id id = db.image_references.insert(**db.image_references._filter_fields (form.vars)) print image ref table written thisImage=db(dbtable.id==form.vars.id).select()[0] calculateImagevar(thisImage) elif form.errors: response.flash = 'Error in Form for Images Database' return dict(form=form) I added the prints just for debugging form accepts is never printed Error: Traceback (most recent call last): File /home/mdipierro/make_web2py/web2py/gluon/restricted.py, line 212, in restricted File F:/Website/web2py/applications/testapp/controllers/default.py http://127.0.0.1:8000/admin/default/edit/Movie_Alarm/controllers/default.py, line 436, in module File /home/mdipierro/make_web2py/web2py/gluon/globals.py, line 194, in lambda File /home/mdipierro/make_web2py/web2py/gluon/tools.py, line 2971, in f File F:/Website/web2py/applications/testapp/controllers/default.py http://127.0.0.1:8000/admin/default/edit/Movie_Alarm/controllers/default.py, line 306, in newImage File /home/mdipierro/make_web2py/web2py/gluon/html.py, line 2185, in process File /home/mdipierro/make_web2py/web2py/gluon/html.py, line 2124, in validate File /home/mdipierro/make_web2py/web2py/gluon/sqlhtml.py, line 1460, in accepts File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 9244, in store RuntimeError: you must specify a Field(...,uploadfolder=...) Error snapshot [image: help] http://127.0.0.1:8000/admin/default/ticket/Movie_Alarm/127.0.0.1.2013-03-26.22-36-51.1dfde815-a9dd-4606-b2cd-529470cb5350# type 'exceptions.RuntimeError'(you must specify a Field(...,uploadfolder=...)) default.py lines around 306 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. print len(request.args),records if len(request.args) and len(records): form = SQLFORM(dbtable, records[0], deletable=True) else: form = SQLFORM.factory(dbtable,db.image_references) if form.process().accepted: print form accepts response.flash = 'Entry for Images Database accepted,start creating thumb' makeThumbnail(dbtable,form.vars.id,(200,200)) print thumbnail done type 'exceptions.RuntimeError'(you must specify a Field(...,uploadfolder=...)) I got no clue what whis line should tell me. thanks -- --- 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+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Image in web2py/MongoDB based blog
but I want to know how can I put an image/video in the text making them appear in the view of the user. I tried using with HTML code but it didn't work. Where will the images come from? Will you store image files in you app folder? Here is a guide to handle images from the book: http://www.web2py.com/books/default/chapter/29/03#An-image-blog If you just need a way of adding images to you views, check the img helper here http://www.web2py.com/books/default/chapter/29/05 -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: scheduler sincronization
I will try to update sqlite as you suggested asap. I tried your scheduler but I cannot see any error. In the meanwhile I have seen that when the following logs are missing INFO - TICKER: workers are 1 INFO - TICKER: tasks are 0 even the log: DEBUG - Assigning tasks... is missing. could this mean that the function wrapped_assign_tasks is not called at all? Paolo 2013/3/26 Niphlod niph...@gmail.com here's the patch. I purposedly blocked the underlying db from another terminal to see what could be the issue, but I can't reproduce in other way what is happening on your system. Enough said, as soon as the db is unlocked, normal operations resume. There are a few error() calls to the logger, now if something goes wrong it's reported accordingly. PS: if you want to stick to SQLite, it's better to install the most updated sqlite adapter, on unix-like OSes is as simple as (giving standard build tools are available) pip install http://pysqlite.googlecode.com/files/pysqlite-2.6.3.tar.gz--global-option build_static and then activating WAL (reduces the chances of a locked db. Not lock free, but certainly helps out). WAL can be activated once on every db with a simple PRAGMA journal_mode=WAL or, if you are on a recent web2py distribution def activate_wal(db_instance): db_instance.execute('PRAGMA journal_mode=WAL;') db = DAL('sqlite://storage.sqlite', after_connection=activate_wal) On Tuesday, March 26, 2013 8:05:44 PM UTC+1, Paolo valleri wrote: I can make few tests but only tomorrow, I will be out for the rest of the week. If you send me a patch with the new log statement, I will come back with the result asap. Paolo 2013/3/26 Niphlod nip...@gmail.com whoa. seems that something wrong is happening trying to assing new tasks normally, every web2py.scheduler.mapserver#**7791 - INFO - TICKER: I'm a ticker should be followed closely by the lines web2py.scheduler.mapserver#**7791 - INFO - TICKER: workers are 1 web2py.scheduler.mapserver#**7791 - INFO - TICKER: tasks are 0 While in your case for several times those lines are not present The fact is that the assignment is wrapped yet in a try except clause and every exception should be logged as well, but your log doesn't show anything of that. I can add more debug lines to the scheduler but this didn't ever happen on all my platforms, so without reproducing it I'm a little bit unsure what the fix can be. On Tuesday, March 26, 2013 4:26:11 PM UTC+1, Paolo valleri wrote: the flle! sorry... Paolo 2013/3/26 paolo@gmail.com paolo@gmail.com If can be useful, I attached part of the log file in which demo1 is executed. First execution: 2013-03-26 15:52:31 second execution: 2013-03-26 15:58:55 (+384s) Paolo 2013/3/26 Paolo valleri paolo@gmail.com import sqlite3 print sqlite3.version 2.6.0 print sqlite3.sqlite_version 3.7.9 But, if the db lock is not the problem, the test application is very easy, where is it supposed to be the problem? On Tuesday, March 26, 2013 2:32:50 PM UTC+1, Niphlod wrote: I find hard to believe that with a single worker, with that function that basically just prints something and an execution every 300 seconds the problem lies into a lock, unless the SQLite library available on your system is reallly old. On Tuesday, March 26, 2013 2:21:21 PM UTC+1, Paolo valleri wrote: When yesterday I saw demo1 in timeout with ps auxf I have seen that a new process was created. For this reason I started to debug scheduler and I asked how to log etc. Moreover, I restarted the scheduler manually so I am not able to understand if the other different names are for an internal problem or something different. Do you think that should be fixed by using a different db engine? Paolo On Tuesday, March 26, 2013 12:42:14 PM UTC+1, Niphlod wrote: with the default logging.conf the timestamp is present as in all other web2py-related logging PS: are you sure that the worker is not killed/restarted by any chance (see the worker_name in the scheduler_run table) On Tuesday, March 26, 2013 11:33:53 AM UTC+1, Paolo valleri wrote: I executed again demo1, I run it several times, I got even in this case elapsed time between two consecutive executions around 360 and even more instead of 300. What can I do to understand what is not working correctly? Moreover, I would suggest to add the timestamp to the scheduler debug log. Paolo 2013/3/25 Niphlod nip...@gmail.com On Monday, March 25, 2013 10:46:12 PM UTC+1, Paolo valleri wrote: I didn't get your point, with one repetitive task, should I start the scheduler with two or more workers? If so, I will try it. The point is that the thread that manages some logic every heartbeat seconds is the one in charge of waiting 5 loops to trigger the additional logic to pick up new tasks (a repetitive task is just a new task to execute). If the process doing the work is busy
[web2py] Re: bootswatch : bootstrap.css replace what file
thank you so much for your detail explaination, ales. so that's the reason why my layout is chaos when i replace web2py_bootstrap.css. another question according to upgrade to 2.3.1, i've download the bootstrap 2.3.1 from http://twitter.github.com/bootstrap/customize.html#components the file bootstrap.min.js is there but i couldn't find bootstrap-responsive.min.css. which file that i must replace from downloaded bootstrap 2.3.1 to default web2py bootstrap-responsive.min.css? best regards, stifan -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: bootswatch : bootstrap.css replace what file
If you download a customized version of Bootstrap, all css are contained in a single file. In this case just use bootstrap.min.css and remove references to bootstrap-responsive.min.css from your code. However, if you download the stock zip from the first page of http://twitter.github.com/bootstraphttp://twitter.github.com/bootstrap/customize.html#components, you'll see bootstrap-responsive.min.css present in the download. Regards, Ales On Wednesday, March 27, 2013 12:56:50 AM UTC+1, 黄祥 wrote: thank you so much for your detail explaination, ales. so that's the reason why my layout is chaos when i replace web2py_bootstrap.css. another question according to upgrade to 2.3.1, i've download the bootstrap 2.3.1 from http://twitter.github.com/bootstrap/customize.html#components the file bootstrap.min.js is there but i couldn't find bootstrap-responsive.min.css. which file that i must replace from downloaded bootstrap 2.3.1 to default web2py bootstrap-responsive.min.css? best regards, stifan -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Cannot submit SQLFORM :/
To close this thread. The workaround: So i had this SQLFORM with default view that did not work. I couldn't fix it, so i created a new controller, pasted the function there, created a dedicated view and it worked. -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: bootswatch : bootstrap.css replace what file
yeah, it's there.thank you very much for your hints, ales. best regards, stifan -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to get selective update rows from SQLFROM.grid
These kinds of problems are usually traceable to holes in the chain of access control tables. How did you create your entries in the auth_group, auth_membership and auth_permission tables? Does the code work correctly if you change the auth.has_permission call to auth.has_membership? Look again to make sure that there is at least one group with the following entry in auth_permission group_id: some arbitrary id from auth_group name: edit table_name: auth_user records: 0 # Cannot be null! If you created the record with a program it might be null. Same for the delete permission. Also please make sure your test user has a record in auth_membership linking its id to the same arbitrary id from auth_group. On Monday, March 25, 2013 6:39:58 AM UTC-4, Sarbjit singh wrote: I did added it in grid, my controller is : @auth.requires_login() def rent(): grid=SQLFORM.grid(db.company, user_signature=False, editable = auth.has_permission('edit','auth_user'), deletable = auth.has_permission('delete','auth_user')) return locals() and models (db.py) are exactly same as you provided. It is not giving any error, but all the results are non editable. Even If I do login with a user 'say Manager and add any record, it is too seen as non editable whereas I want the records added by a user as editable. This line I added in my models because it seems that I haven't defined permission in models. auth.add_permission('edit','mana...@test.com', 'company', 0) I can post the complete db.py as well. Thanks sarbjit On Monday, March 25, 2013 3:12:03 PM UTC+5:30, 黄祥 wrote: did you add this in your grid? editable = auth.has_permission('edit','auth_user'), deletable = auth.has_permission('delete','auth_user') i've already tested it before i posted and it works fine on me. in my test environment for your case i didn't add : auth.add_permission('edit','mana...@test.com', 'company', 0) is there any error? best regards -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] SQLFORM.grid/smartgrid: passing different fields to editargs for parent and child
I'm trying to edit a different subset of fields when editing records for a parent table and a child table. Looking at the source for SQLFORM, it looks like the dictionary passed to editargs is merged on-demand with the formargs dictionary. This is causing errors for me when editing the child table, because it uses the same list of fields. There seems to be no mechanism to pass dictionaries of tablename/value to various arguments in editargs. Has anyone else encountered an issue with grid/smartgrid when editing a child table with editargs set for the parent? Shawn -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Cannot submit SQLFORM :/
About the upload, i'm sending in request.vars the location of the file to upload, so the user does not have to input it manually. This is being called from a backoffice program that will upload : an icon, a zip and a screenshot, so this upload form filling is very convenient. Are you saying you have the location of the files on the user's machine? How do you get that? In any case, you cannot tell the browser to retrieve files directly from the user's local machine -- the browser won't allow it because it's a security risk. Anthony -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Cannot submit SQLFORM :/
On Tuesday, March 26, 2013 8:38:59 PM UTC-4, smoggy wrote: To close this thread. The workaround: So i had this SQLFORM with default view that did not work. I couldn't fix it, so i created a new controller, pasted the function there, created a dedicated view and it worked. Not sure what the problem was -- I tried your exact code and it worked fine for me (i.e., when I clicked submit, I got the Addon added... flash message). Anthony -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] SQLForm.factory
db.images includes an upload field. When using SQLFORM.factory, if you include an upload field, you have to specify its uploadfolder argument (this is not necessary with a standard SQLFORM because the uploadfolder is determined automatically). Anthony On Tuesday, March 26, 2013 5:48:58 PM UTC-4, BlueShadow wrote: Ok I guess I missed that but I get an error at the line if form.process().accepted: I changed my controler to this: def newImage(): dbtable = db.Images #uploads table name print newImage if len(request.args): records = db(dbtable.id==request.args[0]).select() if len(request.args) and len(records): form = SQLFORM(dbtable, records[0], deletable=True) else: form = SQLFORM.factory(dbtable,db.image_references) if form.process().accepted: print form accepts response.flash = 'Entry for Images Database accepted,start creating thumb' makeThumbnail(dbtable,form.vars.id,(200,200)) print thumbnail done id = db.Images.insert(**db.Images._filter_fields(form.vars)) print Image table written form.vars.client=id id = db.image_references.insert(**db.image_references. _filter_fields(form.vars)) print image ref table written thisImage=db(dbtable.id==form.vars.id).select()[0] calculateImagevar(thisImage) elif form.errors: response.flash = 'Error in Form for Images Database' return dict(form=form) I added the prints just for debugging form accepts is never printed Error: Traceback (most recent call last): File /home/mdipierro/make_web2py/web2py/gluon/restricted.py, line 212, in restricted File F:/Website/web2py/applications/testapp/controllers/default.py http://127.0.0.1:8000/admin/default/edit/Movie_Alarm/controllers/default.py, line 436, in module File /home/mdipierro/make_web2py/web2py/gluon/globals.py, line 194, in lambda File /home/mdipierro/make_web2py/web2py/gluon/tools.py, line 2971, in f File F:/Website/web2py/applications/testapp/controllers/default.py http://127.0.0.1:8000/admin/default/edit/Movie_Alarm/controllers/default.py, line 306, in newImage File /home/mdipierro/make_web2py/web2py/gluon/html.py, line 2185, in process File /home/mdipierro/make_web2py/web2py/gluon/html.py, line 2124, in validate File /home/mdipierro/make_web2py/web2py/gluon/sqlhtml.py, line 1460, in accepts File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 9244, in store RuntimeError: you must specify a Field(...,uploadfolder=...) Error snapshot [image: help] http://127.0.0.1:8000/admin/default/ticket/Movie_Alarm/127.0.0.1.2013-03-26.22-36-51.1dfde815-a9dd-4606-b2cd-529470cb5350# type 'exceptions.RuntimeError'(you must specify a Field(...,uploadfolder=...)) default.py lines around 306 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. print len(request.args),records if len(request.args) and len(records): form = SQLFORM(dbtable, records[0], deletable=True) else: form = SQLFORM.factory(dbtable,db.image_references) if form.process().accepted: print form accepts response.flash = 'Entry for Images Database accepted,start creating thumb' makeThumbnail(dbtable,form.vars.id,(200,200)) print thumbnail done type 'exceptions.RuntimeError'(you must specify a Field(...,uploadfolder=...)) I got no clue what whis line should tell me. the first time the default.py shows up with line 436 is very confusing because the file has only 432 lines. Thanks for the help -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] format and represent on table
hi, i've already define format in table but it seems return the id instead of the format i've define, when i define represent on the field of the other field it can work. is it normal? *e.g. work* db.define_table('booking', Field('scheduled_start', 'datetime'), Field('due_date', 'datetime'), Field('court', 'reference court'), Field('customer', 'reference customer'), Field('description', 'text'), format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, r.customer.last_name, r.court.branch.address, r.court.court_no)) db.define_table('check_in', Field('is_booking', 'boolean'), Field('booking', 'reference booking'*, represent=lambda id, r: '%s %s-%s-%s' % (r.customer.first_name, r.customer.last_name, r.court.branch.address, r.court.court_no)*), Field('court', 'reference court'), Field('customer', 'reference customer'), Field('description', 'text'), format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, r.customer.last_name, r.court.branch.address, r.court.court_no)) *e.g. not work* db.define_table('booking', Field('scheduled_start', 'datetime'), Field('due_date', 'datetime'), Field('court', 'reference court'), Field('customer', 'reference customer'), Field('description', 'text'), format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, r.customer.last_name, r.court.branch.address, r.court.court_no)) db.define_table('check_in', Field('is_booking', 'boolean'), Field('booking', 'reference booking'), Field('court', 'reference court'), Field('customer', 'reference customer'), Field('description', 'text'), format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, r.customer.last_name, r.court.branch.address, r.court.court_no)) thank you very much in advance -- --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.