[web2py] Re: Unable to edit static files in web-editor
which version of web2py are you using? have you seen any log in chrome console? Paolo On Monday, January 27, 2014 1:02:53 AM UTC+1, Yuriy Lopin wrote: https://lh4.googleusercontent.com/-lyoYCcRJgZk/UuWiH1VnZLI/AI8/LRo9EUzD-iw/s1600/54426627.jpg When I click some static js file even in example application, I get like this empty editing area. So I cant edit file. Any suggestions what it can be? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Error when logging in
Hi friends. I have a problem some time with one of the instances of web2py I have. It's running using wsgi on apache, using web2py version 2.8.2. For some unexplained reason, when I try to log in, using a regular username / password login, I get this ticket. Traceback (most recent call last): File /home/keebali/adserver_install/web2py/gluon/main.py, line 461, in wsgibase session._try_store_in_db(request, response) File /home/keebali/adserver_install/web2py/gluon/globals.py, line 1052, in _try_store_in_db (self._unchanged(response) and not response.session_new)): File /home/keebali/adserver_install/web2py/gluon/globals.py, line 1041, in _unchanged session_pickled = cPickle.dumps(self) File /usr/lib64/python2.6/copy_reg.py, line 84, in _reduce_ex dict = getstate() TypeError: 'NoneType' object is not callable It doesn't happen all the time, and when I restart apache, the problem just fixes itself. As you can see, the error has nothing to do with my own code (not the controller, nor any of the models participate on the error). I can, however say, that the login problems appeared when I first added https version of my website, though It doesn't neccerly happens on the https instance. Any idea? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] web2py.com website broken
Many pages on web2py.com are currently failing (eg tickethttp://www.web2py.com/admin/default/ticket/init/115.70.50.12.2014-01-28.09-12-12.f5a5077f-8b13-4bc3-9266-64f9d050ad6c) . Sorry if this isn't the right forum. Jeremy -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How to do a insert..select with DAL?
Is there a way to do insert.. select with DAL? I would like to do something like this: insert into table1 (col1, col2, col3, col4) select col5, col6, 'val1', 'val2' from table2 where col5 = 'val3' Thanks Dragan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to do a insert..select with DAL?
of course you can, I suggest to read here http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#insert On Tuesday, January 28, 2014 1:39:34 PM UTC+1, Dragan Matic wrote: Is there a way to do insert.. select with DAL? I would like to do something like this: insert into table1 (col1, col2, col3, col4) select col5, col6, 'val1', 'val2' from table2 where col5 = 'val3' Thanks Dragan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] links requires authorization??
I have the following: In db.py: db.define_table('orders', Field('buyer_id',db.auth_user,readable=False), Field('order_date','datetime'), Field('status')) In index.html: {{=SQLFORM.grid(db.orders, maxtextlength=1000, paginate=20, sortable=False, searchable=False, details=False, editable=False, deletable=False, create=False, *links=[lambda row: A('view',_href=URL('view_order',args=[db.orders,row.id]))],* csv=False) }} Why is the links=... causing the (flash) error message not authorized? I'm able to use links=... elsewhere without any problem. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Email and PGP
As per the web2py book, I've installed python-pyme and created the key files (for sender 'my_han...@gmail.com'). I have the following code: mail = Mail('smtp.gmail.com:587','my_han...@gmail.com','my_handle:my_password') mail.settings.gpg_home = '/home/www-data/.gnupg/' mail.settings.cipher_type = 'gpg' mail.settings.sign = True mail.settings.sign_passphrase = 'my_passphrase' mail.settings.encrypt = True status = mail.send('some_han...@gmail.com','some subject','some text') The mail.send() is failing. What's wrong? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Button in Component Stealing Focus?
where ? On Tuesday, January 28, 2014 1:08:37 AM UTC+1, EW wrote: Sorry for the delay. Here it is. Type something in the search box and press enter. On Tuesday, January 21, 2014 12:36:55 PM UTC-8, Niphlod wrote: pack a minimal app to reproduce the behaviour. Without it, we'll just provide unuseful hints. On Tuesday, January 21, 2014 6:32:30 PM UTC+1, EW wrote: I have a load component with a button in it that seems to automatically have the focus such that if I go to my URL and press the enter key, that is the button that is triggered. But, I also have a textbox and a button outside the component. I would like it so that when you type something in the textbox and press enter, the adjacent button is clicked. However, what happens is that the button in the component is clicked instead. I tried putting a jquery handler so that on keyup in my textbox, if the keycode is 13 (for enter), the adjacent button will be clicked, but it is not working--upon pressing enter, the component button is being clicked immediately such that my jquery handler is never reached. I know that my jquery handler is correct though because it is reached when I type anything other than enter. I also tried just setting the focus on my button when the page loads, which works in that going to the URL and pressing enter triggers it. However, once I click on/type something in the textbox, the focus is returned to that button in the component, so this does not help at all. Any ideas? I am using IE btw. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Email and PGP
Could you please print mail.err after the failed send? 2014. január 28., kedd 14:22:59 UTC+1 időpontban horridohobbyist a következőt írta: As per the web2py book, I've installed python-pyme and created the key files (for sender 'my_h...@gmail.com javascript:'). I have the following code: mail = Mail('smtp.gmail.com:587','my_han...@gmail.comjavascript: ','my_handle:my_password') mail.settings.gpg_home = '/home/www-data/.gnupg/' mail.settings.cipher_type = 'gpg' mail.settings.sign = True mail.settings.sign_passphrase = 'my_passphrase' mail.settings.encrypt = True status = mail.send('some_...@gmail.com javascript:','some subject','some text') The mail.send() is failing. What's wrong? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to do a insert..select with DAL?
Sorry but I have read there and all I can see is simple insert and bulk_insert, neither of them are insert..select. On Tuesday, January 28, 2014 1:48:10 PM UTC+1, Paolo Valleri wrote: of course you can, I suggest to read here http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#insert On Tuesday, January 28, 2014 1:39:34 PM UTC+1, Dragan Matic wrote: Is there a way to do insert.. select with DAL? I would like to do something like this: insert into table1 (col1, col2, col3, col4) select col5, col6, 'val1', 'val2' from table2 where col5 = 'val3' Thanks Dragan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Button in Component Stealing Focus?
whoops, got where. Please, update web2py and replace web2py.js in your app. It behaves exactly as it should and doesn't show the behaviour you're describing. On Tuesday, January 28, 2014 2:24:14 PM UTC+1, Niphlod wrote: where ? On Tuesday, January 28, 2014 1:08:37 AM UTC+1, EW wrote: Sorry for the delay. Here it is. Type something in the search box and press enter. On Tuesday, January 21, 2014 12:36:55 PM UTC-8, Niphlod wrote: pack a minimal app to reproduce the behaviour. Without it, we'll just provide unuseful hints. On Tuesday, January 21, 2014 6:32:30 PM UTC+1, EW wrote: I have a load component with a button in it that seems to automatically have the focus such that if I go to my URL and press the enter key, that is the button that is triggered. But, I also have a textbox and a button outside the component. I would like it so that when you type something in the textbox and press enter, the adjacent button is clicked. However, what happens is that the button in the component is clicked instead. I tried putting a jquery handler so that on keyup in my textbox, if the keycode is 13 (for enter), the adjacent button will be clicked, but it is not working--upon pressing enter, the component button is being clicked immediately such that my jquery handler is never reached. I know that my jquery handler is correct though because it is reached when I type anything other than enter. I also tried just setting the focus on my button when the page loads, which works in that going to the URL and pressing enter triggers it. However, once I click on/type something in the textbox, the focus is returned to that button in the component, so this does not help at all. Any ideas? I am using IE btw. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Is there a way to cache images from download function?
lots and lots of time passed under the bridge. Now there's cache.action ... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to do a insert..select with DAL?
DAL doesn't allow you to do that. Either you code it with bulk_insert or with a loop of db.table.insert ot with executesql. On Tuesday, January 28, 2014 2:27:27 PM UTC+1, Dragan Matic wrote: Sorry but I have read there and all I can see is simple insert and bulk_insert, neither of them are insert..select. On Tuesday, January 28, 2014 1:48:10 PM UTC+1, Paolo Valleri wrote: of course you can, I suggest to read here http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#insert On Tuesday, January 28, 2014 1:39:34 PM UTC+1, Dragan Matic wrote: Is there a way to do insert.. select with DAL? I would like to do something like this: insert into table1 (col1, col2, col3, col4) select col5, col6, 'val1', 'val2' from table2 where col5 = 'val3' Thanks Dragan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: links requires authorization??
strange..but the syntax is odd at best. did you try with args=['orders', row.id] ? On Tuesday, January 28, 2014 1:56:25 PM UTC+1, horridohobbyist wrote: I have the following: In db.py: db.define_table('orders', Field('buyer_id',db.auth_user,readable=False), Field('order_date','datetime'), Field('status')) In index.html: {{=SQLFORM.grid(db.orders, maxtextlength=1000, paginate=20, sortable=False, searchable=False, details=False, editable=False, deletable=False, create=False, *links=[lambda row: A('view',_href=URL('view_order',args=[db.orders,row.id http://row.id]))],* csv=False) }} Why is the links=... causing the (flash) error message not authorized? I'm able to use links=... elsewhere without any problem. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Email and PGP
AttributeError: 'Mail' object has no attribute 'err' On Tuesday, 28 January 2014 08:25:43 UTC-5, szimszon wrote: Could you please print mail.err after the failed send? 2014. január 28., kedd 14:22:59 UTC+1 időpontban horridohobbyist a következőt írta: As per the web2py book, I've installed python-pyme and created the key files (for sender 'my_h...@gmail.com'). I have the following code: mail = Mail('smtp.gmail.com:587','my_han...@gmail.com ','my_handle:my_password') mail.settings.gpg_home = '/home/www-data/.gnupg/' mail.settings.cipher_type = 'gpg' mail.settings.sign = True mail.settings.sign_passphrase = 'my_passphrase' mail.settings.encrypt = True status = mail.send('some_...@gmail.com','some subject','some text') The mail.send() is failing. What's wrong? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: links requires authorization??
I got this syntax from an example in the book, I think. At any rate, it works elsewhere, like I said. Thanks. On Tuesday, 28 January 2014 08:33:31 UTC-5, Niphlod wrote: strange..but the syntax is odd at best. did you try with args=['orders', row.id] ? On Tuesday, January 28, 2014 1:56:25 PM UTC+1, horridohobbyist wrote: I have the following: In db.py: db.define_table('orders', Field('buyer_id',db.auth_user,readable=False), Field('order_date','datetime'), Field('status')) In index.html: {{=SQLFORM.grid(db.orders, maxtextlength=1000, paginate=20, sortable=False, searchable=False, details=False, editable=False, deletable=False, create=False, *links=[lambda row: A('view',_href=URL('view_order',args=[db.orders,row.id http://row.id]))],* csv=False) }} Why is the links=... causing the (flash) error message not authorized? I'm able to use links=... elsewhere without any problem. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: links requires authorization??
Are you saying the inclusion of the links argument in the grid is causing mere loading of the grid to result in a not authorized message, or do you get that message when you actually click a link? Does the link point back to the grid action, or is view_order a separate function? In general, the grid itself should only return a not authorized message if user_signature=True (which is the default) and the requested URL doesn't meet the appropriate criteria. Anthony On Tuesday, January 28, 2014 7:56:25 AM UTC-5, horridohobbyist wrote: I have the following: In db.py: db.define_table('orders', Field('buyer_id',db.auth_user,readable=False), Field('order_date','datetime'), Field('status')) In index.html: {{=SQLFORM.grid(db.orders, maxtextlength=1000, paginate=20, sortable=False, searchable=False, details=False, editable=False, deletable=False, create=False, *links=[lambda row: A('view',_href=URL('view_order',args=[db.orders,row.id http://row.id]))],* csv=False) }} Why is the links=... causing the (flash) error message not authorized? I'm able to use links=... elsewhere without any problem. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Accessing a table with a reference field
Probably related to user_signature. Are you accessing the grid function with extra args in the URL but not passing those args to .grid via the args argument? On Tuesday, January 28, 2014 12:00:29 AM UTC-5, horridohobbyist wrote: Oh, sorry, I erred. That's not the problem. Please disregard until I investigate further. On Monday, 27 January 2014 23:47:05 UTC-5, horridohobbyist wrote: I have two tables defined: db.define_table('orders', Field('buyer_id',db.auth_user), Field('order_date','datetime'), Field('status')) db.define_table('ordered_items', Field('order_num','reference orders'), Field('product_id',db.products)) When I try to display the ordered_items table with this: {{=SQLFORM.grid(db.ordered_items, maxtextlength=1000, paginate=10, sortable=False, searchable=False, details=False, editable=False, deletable=False, create=False, csv=False) }} ...I get an error message saying not authorized. What?! Why??? (I have a sneaking suspicion it's related to the 'reference orders' data type.) And how do I get authorization? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Minimum password length not working?
You have to set it before calling auth.define_tables(). Also, it will have no effect if you set your own db.auth_user.password.requires. Anthony On Tuesday, January 28, 2014 2:52:07 AM UTC-5, User wrote: In the web2py book it says: By default, auth also requires a minimum password length of 4. This can be changed: auth.settings.password_min_length = 4 (from http://www.web2py.com/book/default/chapter/09#Settings-and-messages) So I tried changing to: auth.settings.password_min_length = 7 After web2py server restart this still allows registration with a password less than 7 characters (4 still seems to be the minimum). What am I missing? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Email and PGP
Sorry, mail.error :-o my bad. 2014. január 28., kedd 14:35:55 UTC+1 időpontban horridohobbyist a következőt írta: AttributeError: 'Mail' object has no attribute 'err' On Tuesday, 28 January 2014 08:25:43 UTC-5, szimszon wrote: Could you please print mail.err after the failed send? 2014. január 28., kedd 14:22:59 UTC+1 időpontban horridohobbyist a következőt írta: As per the web2py book, I've installed python-pyme and created the key files (for sender 'my_h...@gmail.com'). I have the following code: mail = Mail('smtp.gmail.com:587','my_han...@gmail.com ','my_handle:my_password') mail.settings.gpg_home = '/home/www-data/.gnupg/' mail.settings.cipher_type = 'gpg' mail.settings.sign = True mail.settings.sign_passphrase = 'my_passphrase' mail.settings.encrypt = True status = mail.send('some_...@gmail.com','some subject','some text') The mail.send() is failing. What's wrong? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Accessing a table with a reference field
Yes, you're right. I had to set user_signature=False. Not that I understand why it's necessary... Thanks. On Tuesday, 28 January 2014 10:05:51 UTC-5, Anthony wrote: Probably related to user_signature. Are you accessing the grid function with extra args in the URL but not passing those args to .grid via the args argument? On Tuesday, January 28, 2014 12:00:29 AM UTC-5, horridohobbyist wrote: Oh, sorry, I erred. That's not the problem. Please disregard until I investigate further. On Monday, 27 January 2014 23:47:05 UTC-5, horridohobbyist wrote: I have two tables defined: db.define_table('orders', Field('buyer_id',db.auth_user), Field('order_date','datetime'), Field('status')) db.define_table('ordered_items', Field('order_num','reference orders'), Field('product_id',db.products)) When I try to display the ordered_items table with this: {{=SQLFORM.grid(db.ordered_items, maxtextlength=1000, paginate=10, sortable=False, searchable=False, details=False, editable=False, deletable=False, create=False, csv=False) }} ...I get an error message saying not authorized. What?! Why??? (I have a sneaking suspicion it's related to the 'reference orders' data type.) And how do I get authorization? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] issue with external cron
thanks for the example. But when I run the cron jobs directly from system cron I guess it's not possible to set permissions. e.g. @auth.requires_membership('admin') def update_vacation_days(): ... this means controller functions needed for cron jobs can be called from everyone. Unless I define some firewall rules. This doesn't seem like a perfect solution. Has anyone further information why external does not run as it should? seems like my cron jobs are only executed ~50% of the time which is of course a big problem for my live system. Maybe I should consider switching to the scheduler as you suggested. What's the status of the scheduler? does it run reliable? A benefit of the scheduler would be that I can always see the status of the current job and when it was executed the last time. This information could be very useful for some internal monitoring. regards, Alex On Saturday, January 25, 2014 3:55:11 AM UTC+1, Jonathan Lundell wrote: On 24 Jan 2014, at 6:54 PM, Jonathan Lundell jlun...@pobox.comjavascript: wrote: On 24 Jan 2014, at 4:05 PM, Alex mrau...@gmail.com javascript: wrote: could you give more details? why do you start it that way, did you experience any problems with external cron? how does the command for the system cron exactly look like? does it have any disadvantages to external cron? any ideas how I could track down those issues? The general idea is that you can run a function directly from the command line, so you can also run it directly from system cron. The difference between that and external cron is that it completely bypasses web2py's internal cron handling, which the last time I looked at it (it's been a while) did not look reliable to me. Here's a sample from my crontab template (system crontab, not web2py crontab). I run web2py in a virtualenv; hence the activate. The controller/function is tasks/idf. 0 * * * * source %(virtualenv)s/bin/activate cd %(web2pydir)s python web2py.py -J -M -S %(appname)s/tasks/idf -a recycle /tmp/cron.output 21 Alternatively, consider using the scheduler instead of cron. thanks On Saturday, January 25, 2014 12:55:50 AM UTC+1, Jonathan Lundell wrote: On 24 Jan 2014, at 3:38 PM, Alex mrau...@gmail.com wrote: I've got a big issue with external cron jobs. In my application I've added tasks to crontab which should be executed every day, e.g. 0 0 * * * myapp *applications/myapp/cron/task_update_vacation_days.py 30 0 * * * myapp *applications/myapp/cron/task_insert_public_holidays.py Now I found out that the cron jobs are not executed every day on the live server. The cron jobs are started from a system cron job as specified in the documentation: python web2py.py -J -C -D 1 /tmp/cron.customer.output The jobs are executed very irregular, some jobs get executed almost every day and others just 2 times in the last 7 days. here is the output for task_update_vacation_days: INFO:web2py.cron:WEB2PY CRON (external): myapp executing *applications/myapp/cron/task_update_vacation_days.py in /srv/web/customer/web2py at 2014-01-25 00:00:02.179185 INFO:web2py.cron:WEB2PY CRON (external): myapp executing *applications/myapp/cron/task_update_vacation_days.py in /srv/web/customer/web2py at 2014-01-18 00:00:02.291735 then I checked the syslog to make sure web2py.py -J -C -D 1 was called exactly every minute. so the problem seems to be that web2py somehow thinks the task should not be started? how can this happen? does anyone have an idea? What I've been doing is to run my cron jobs directly from system cron, using -S and -R. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Is there a way to cache images from download function?
Ok I tried: @cache.action(time_expire=1200, cache_model=cache.memcache, quick='SVL') def fast_download(): import time, os import contenttype as c # very basic security: if not request.args(0).startswith(file.file): return download() file_id = request.args(-1) myfile = db.file(db.file.file==file_id) filename, file = db.file.file.retrieve(myfile.file) response.headers[Content-Type] = c.contenttype(file_id) response.headers[Content-Disposition] = attachment; filename=%s %filename #response.headers['Last-Modified'] = time.strftime(%a, %d %b %Y %H:%M:%S +, time.localtime(myfile.last_modified)) stream = response.stream(file, chunk_size=64*1024, request=request) raise HTTP(200, stream, **response.headers) Now I'm getting an error: PicklingError: Can't pickle type 'generator': attribute lookup __builtin__.generator failed Is there a way to response.render the download? On Wednesday, January 29, 2014 2:30:37 AM UTC+13, Niphlod wrote: lots and lots of time passed under the bridge. Now there's cache.action ... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Email and PGP
The error message is No key for signing [my_han...@gmail.com]. I did create the key files with gpg for sender my_han...@gmail.com. By default, they're created in my home directory, so I moved the .gnupg folder to /home/www-data/ and chown'd it and its contents to www-data:www-data. I don't know if there are any other steps besides the above. I used the same sender email and passphrase in creating the keys. So everything should be okay. Thanks. On Tuesday, 28 January 2014 10:51:31 UTC-5, szimszon wrote: Sorry, mail.error :-o my bad. 2014. január 28., kedd 14:35:55 UTC+1 időpontban horridohobbyist a következőt írta: AttributeError: 'Mail' object has no attribute 'err' On Tuesday, 28 January 2014 08:25:43 UTC-5, szimszon wrote: Could you please print mail.err after the failed send? 2014. január 28., kedd 14:22:59 UTC+1 időpontban horridohobbyist a következőt írta: As per the web2py book, I've installed python-pyme and created the key files (for sender 'my_h...@gmail.com'). I have the following code: mail = Mail('smtp.gmail.com:587','my_han...@gmail.com ','my_handle:my_password') mail.settings.gpg_home = '/home/www-data/.gnupg/' mail.settings.cipher_type = 'gpg' mail.settings.sign = True mail.settings.sign_passphrase = 'my_passphrase' mail.settings.encrypt = True status = mail.send('some_...@gmail.com','some subject','some text') The mail.send() is failing. What's wrong? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] _link args
I have the following line of code to generate a menu item: a onclick=web2py_component('{{=_link}}', 'content'); {{if request.args(1, cast=int) = TIER2ID:}}; web2py_component('{{=URL('init', 'handler', 'hero_image')}}', 'image') {{pass}}{{=_name.replace('_', ' ').capitalize()}}/a _link has three args. Is it possible to access these args, I need them in the second call to web2py_component. Kind regards, Annet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Is there a way to cache images from download function?
wasn't the original point just to add the proper headers ? Of course you can't cache a generator (that is what response.stream returns) It makes no sense at all to store the actual contents of the file on memcache On Tuesday, January 28, 2014 7:46:18 PM UTC+1, James Burke wrote: Ok I tried: @cache.action(time_expire=1200, cache_model=cache.memcache, quick='SVL') def fast_download(): import time, os import contenttype as c # very basic security: if not request.args(0).startswith(file.file): return download() file_id = request.args(-1) myfile = db.file(db.file.file==file_id) filename, file = db.file.file.retrieve(myfile.file) response.headers[Content-Type] = c.contenttype(file_id) response.headers[Content-Disposition] = attachment; filename=%s %filename #response.headers['Last-Modified'] = time.strftime(%a, %d %b %Y %H:%M:%S +, time.localtime(myfile.last_modified)) stream = response.stream(file, chunk_size=64*1024, request=request) raise HTTP(200, stream, **response.headers) Now I'm getting an error: PicklingError: Can't pickle type 'generator': attribute lookup __builtin__.generator failed Is there a way to response.render the download? On Wednesday, January 29, 2014 2:30:37 AM UTC+13, Niphlod wrote: lots and lots of time passed under the bridge. Now there's cache.action ... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: _link args
_link is just a string, so you would have to parse it to extract the last three args. If there is no query string after the last arg, you could do: _link.split('/')[-3:] That will give you the last three segments of the URL in a list. If there is a query string, you would need to remove it (i.e., everything from the ? on) from the last arg. Anthony On Tuesday, January 28, 2014 2:07:31 PM UTC-5, Annet wrote: I have the following line of code to generate a menu item: a onclick=web2py_component('{{=_link}}', 'content'); {{if request.args(1, cast=int) = TIER2ID:}}; web2py_component('{{=URL('init', 'handler', 'hero_image')}}', 'image') {{pass}}{{=_name.replace('_', ' ').capitalize()}}/a _link has three args. Is it possible to access these args, I need them in the second call to web2py_component. Kind regards, Annet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Caching selects or use memcache, is it the same?
Thanks! Tito On Mon, Jan 27, 2014 at 5:19 PM, Niphlod niph...@gmail.com wrote: memcache is a storage engine that web2py can use to cache selects. Both memcache or redis are faster than cache.ram or cache.disk (especially with concurrent access): those are pure-python solutions embedded in the framework. On Monday, January 27, 2014 3:50:36 PM UTC+1, Tito Garrido wrote: Hi Folks, I am planning a new application and I am wondering, should I use memcache instead of cache selects? Do I need to use memcache if I am using cache select? Which one is faster? What is the best practice? The plan is to cache some selects to show in view and get a fast response time. Thanks in advance, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] DAL: tables that reference tables that reference tables...
It appears that there are two ways to get a field to reference another table, Field(my_field, requires=IS_IN_DB(db, db.some_table)) and Field(my_field_2, db.some_table_2) The problem with both of these (and especially the first one), is that I can't seem to get the format for my_field to grab the format of some_table and my_field_2 can't grab the format from tables that some_table_2 uses in its format. To be more concrete about it, I'm building an application that tracks service work done on vehicles. I'd like to have a table of manufacturers, then a table that references the manufacturers and associates them with models, then configurations of those models, then particular vehicles that associate a configuration and an owner with other data like the VIN. In both formulations that I've tried, the admin interface becomes incredibly confusing because I'm mostly having to remember what id is associated with a particular entry. Here's a simplified version of my code so far: db.define_table(test_person, Field(fname, requires=IS_NOT_EMPTY()), Field(lname, requires=IS_NOT_EMPTY()), format = %(fname)s %(lname)s) db.define_table(test_manufacturer, Field(name), format = %(name)s) db.define_table(test_model, Field(manufacturer, requires=IS_IN_DB(db, db.test_manufacturer)), Field(model_year), Field(model), format = %(model_year)s %(manufacturer)s %(name)s) db.define_table(test_model_configuration, Field(model, requires=IS_IN_DB(db, db.test_model)), Field(config, label=Configuration), format = %(model)s %(config)s) db.define_table(test_vehicle, Field(vehicle_owner, requires=IS_IN_DB(db, db.test_person)), Field(model_config, requires=IS_IN_DB(db, db.test_model_configuration), label=model), Field(vin, label=VIN), format = %(vehicle_owner)s's %(model)s) db.define_table(test_model_2, Field(manufacturer, db.test_manufacturer), Field(model_year), Field(model), format = %(model_year)s %(manufacturer)s %(model)s) db.define_table(test_model_configuration_2, Field(model, db.test_model_2), Field(config, label=Configuration), format = %(model)s %(config)s) db.define_table(test_vehicle_2, Field(vehicle_owner, db.test_person), Field(model_config, db.test_model_configuration_2, label=model), Field(vin, label=VIN), format = %(vehicle_owner)s's %(model)s) I suppose I could get this to work if I had a flatter database. That is, if I stuffed the manufacturer, model, and configuration into a single table, the vehicle would only be looking up one table and could grab all the information it needed. However, I can see this being a problem when I want to start doing things with the vehicles (e.g. John Doe's 1999 Honda Accord LX), which I don't want to be displayed as 82's 16 1 for which I'd have to look up the id numbers to make any sense of it. If I need to ignore the admin interface entirely during this initial testing phase, I'm still not sure what the most Pythonic/web2pythonic way of getting all the information into my views is. My guess is that it would be done in the controller by making a dictionary associating id numbers with desired formats, but that seems like it would require a lot of looping, which would bog everything down in a large-scale application. Basically, I'm completely stumped as to the intelligent/right way to proceed. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] web2py.js disables submit buttons when submitting form with ajax
Hi! I'm trying to submit form with $.post(), by attaching function handling event submit. And when it send ajax request to server some handler from web2py.js disables submit button, and changes it's value to Working Alright, it is good behavior. But it doesn't re-enable it after ajax comletes. What I do wrong, or what need I do to enable form submission again? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: web2py and python 3.3 ?
On Saturday, June 16, 2012 4:26:06 PM UTC-7, Massimo Di Pierro wrote: There is a fork of web2py that works on 3.3 but this is not a feature we want to officially support or advertise. It will break almost all of existing apps. massimo On Saturday, 16 June 2012 17:17:55 UTC-5, samuel bonilla wrote: web2py 2.0 will supports python 3.3 ? Where is the python3 fork so start with that version? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Getting 'MySQL server has gone away' on PythonAnywhere
There have been several versions of this issue discussed but none of them are yielding results for me. Once every 3-4 days, I begin receiving the error text below. What perplexes me is that not only does my app fail to run with this error, but the admin site produces the same error. When I get this error, I am still able to connect to and query my database using MySQL Workbence 6.0 and the folks at PythonAnywhere aren't seeing anything unusual in the db logs. I'm getting this error when I attempt to log in so there are no long running operations at play. Any ideas on where to begin troubleshooting? Versionweb2py™Version 2.8.2-stable+timestamp.2013.11.28.13.54.07PythonPython 2.7.5+: /usr/local/bin/uwsgi (prefix: /usr)Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. Traceback (most recent call last): File /home/coastinnovations/web2py/oxpeckertools-int/gluon/main.py, line 543, in wsgibase BaseAdapter.close_all_instances('rollback') File /home/coastinnovations/web2py/oxpeckertools-int/gluon/dal.py, line 599, in close_all_instances db._adapter.close(action) File /home/coastinnovations/web2py/oxpeckertools-int/gluon/dal.py, line 579, in close getattr(self, action)() File /home/coastinnovations/web2py/oxpeckertools-int/gluon/dal.py, line 1872, in rollback return self.connection.rollback() OperationalError: (2006, 'MySQL server has gone away') Error snapshot [image: help]https://int.oxpeckertools.com/admin/ticket/admin/110.38.54.59.2014-01-21.13-48-29.0c4b2eeb-b534-4642-965d-8b9eea8b1fea# class '_mysql_exceptions.OperationalError'((2006, 'MySQL server has gone away')) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] DAL: problems with tables that reference tables
I'm currently attempting to write a web2py application to keep track of servicing at the shop where I work as a mechanic. This is my first experience at web2py, so please excuse me if the answer to this is obvious. The problem that I have right now is how objects that are built up from nested tables are displayed. That's probably a poor way of describing it, so I'll demonstrate. Here's a simplified version of what I'm trying to do: db.define_table(test_person, Field(fname, requires=IS_NOT_EMPTY()), Field(lname, requires=IS_NOT_EMPTY()), format = %(fname)s %(lname)s) db.define_table(test_manufacturer, Field(name), format = %(name)s) db.define_table(test_model, Field(manufacturer, requires=(IS_IN_DB(db, db.test_manufacturer))), Field(model_year), Field(model), format = %(model_year)s %(name)s) db.define_table(test_vehicle, Field(vehicle_owner, requires=IS_IN_DB(db, db.test_person)), Field(model, requires=IS_IN_DB(db, db.test_model)), Field(vin, label=VIN), format = %(vehicle_owner)s's %(model)s) So if I go to the admin interface and try to add a new record for test_vehicle, I get a drop down list of id integers instead of names. There was a suggestion I found somewhere on stackexchange that looks like the following: db.define_table(test_model_2, Field(manufacturer, db.test_manufacturer), Field(model_year), Field(model), format = %(model_year)s %(manufacturer)s %(model)s) db.define_table(test_vehicle_2, Field(vehicle_owner, db.test_person), Field(model, db.test_model_2), Field(vin, label=VIN), format = %(vehicle_owner)s's %(model)s) That solution nearly works. Now when I made a new test_model_2 instance, I can see if I'm working with a Honda or a Toyota instead of a 1 or a 2. However, when I try to make a new test_vehicle_2 record, I can select from things like 2011 1 Accord instead of 2011 Honda Accord. I suppose I could deal with the admin interface being pretty much useless for adding new records, but I'm not sure what the most Pythonic/web2pythonic way of making controllers/views to enter new data would be. I can also see how making my database flatter might help (i.e. don't separate manufacturer and model into different tables), but I'm sure I'll run into problems trying to make everything reference something only one level above itself. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: can't edit static files by web-editor
What browser? On Sunday, 26 January 2014 17:45:04 UTC-6, Yuriy Lopin wrote: When i click some file in static folder i get - http://screen.w3.ua/Jan14/54426627.jpg You see - there is no any code. Plz answer why? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: web2py and python 3.3 ?
Those are too old. I suggest you adopt a module and the time (start with template.py) and port that. On Monday, 27 January 2014 17:23:42 UTC-6, kevin cloinger wrote: On Saturday, June 16, 2012 4:26:06 PM UTC-7, Massimo Di Pierro wrote: There is a fork of web2py that works on 3.3 but this is not a feature we want to officially support or advertise. It will break almost all of existing apps. massimo On Saturday, 16 June 2012 17:17:55 UTC-5, samuel bonilla wrote: web2py 2.0 will supports python 3.3 ? Where is the python3 fork so start with that version? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Email and PGP
GnuPG seems to be intimately tied to the user account on Linux. It always, always expects .gnupg to be in /home/richard/. I can't seem to give it an alternate location. Thinking that it might be a file ownership problem, I chown'd .gnupg and everything in it to www-data:www-data, but this gave me the mail.error GPG error:Invocation of gpgme_op_sign:Unspecified source:General error. I chown'd everything back to richard:richard, and I got the mail.error No key for signing [my_han...@gmail.com]. So I lose either way! It's probably not a file ownership problem. I am totally baffled by this. Is PGP Email in web2py broken? Has anyone used it successfully recently?? Another question I have is: Must I have the public key for the receiver of my encrypted email before I can send? I'm grasping at straws, I know. Thanks. On Tuesday, 28 January 2014 13:53:02 UTC-5, horridohobbyist wrote: The error message is No key for signing [my_han...@gmail.com]. I did create the key files with gpg for sender my_han...@gmail.com. By default, they're created in my home directory, so I moved the .gnupg folder to /home/www-data/ and chown'd it and its contents to www-data:www-data. I don't know if there are any other steps besides the above. I used the same sender email and passphrase in creating the keys. So everything should be okay. Thanks. On Tuesday, 28 January 2014 10:51:31 UTC-5, szimszon wrote: Sorry, mail.error :-o my bad. 2014. január 28., kedd 14:35:55 UTC+1 időpontban horridohobbyist a következőt írta: AttributeError: 'Mail' object has no attribute 'err' On Tuesday, 28 January 2014 08:25:43 UTC-5, szimszon wrote: Could you please print mail.err after the failed send? 2014. január 28., kedd 14:22:59 UTC+1 időpontban horridohobbyist a következőt írta: As per the web2py book, I've installed python-pyme and created the key files (for sender 'my_h...@gmail.com'). I have the following code: mail = Mail('smtp.gmail.com:587','my_han...@gmail.com ','my_handle:my_password') mail.settings.gpg_home = '/home/www-data/.gnupg/' mail.settings.cipher_type = 'gpg' mail.settings.sign = True mail.settings.sign_passphrase = 'my_passphrase' mail.settings.encrypt = True status = mail.send('some_...@gmail.com','some subject','some text') The mail.send() is failing. What's wrong? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Accessing a table with a reference field
If you set user_signature=False you are giving everybody (and I mean everybody) read/write permissions to your database. On Tuesday, 28 January 2014 11:16:23 UTC-6, horridohobbyist wrote: Yes, you're right. I had to set user_signature=False. Not that I understand why it's necessary... Thanks. On Tuesday, 28 January 2014 10:05:51 UTC-5, Anthony wrote: Probably related to user_signature. Are you accessing the grid function with extra args in the URL but not passing those args to .grid via the args argument? On Tuesday, January 28, 2014 12:00:29 AM UTC-5, horridohobbyist wrote: Oh, sorry, I erred. That's not the problem. Please disregard until I investigate further. On Monday, 27 January 2014 23:47:05 UTC-5, horridohobbyist wrote: I have two tables defined: db.define_table('orders', Field('buyer_id',db.auth_user), Field('order_date','datetime'), Field('status')) db.define_table('ordered_items', Field('order_num','reference orders'), Field('product_id',db.products)) When I try to display the ordered_items table with this: {{=SQLFORM.grid(db.ordered_items, maxtextlength=1000, paginate=10, sortable=False, searchable=False, details=False, editable=False, deletable=False, create=False, csv=False) }} ...I get an error message saying not authorized. What?! Why??? (I have a sneaking suspicion it's related to the 'reference orders' data type.) And how do I get authorization? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Uploading application to server
Unfortunately, when I removed admin app I removed welcome app too. I've tried to upload my local welcome app to the server and every access gives me the same error: Traceback (most recent call last): File /Applications/web2py/gluon/ main.py, line 492, in wsgibase create_missing_app_folders(request) File /Applications/web2py/gluon/admin.py, line 488, in create_missing_app_folders os.mkdir(path) OSError: [Errno 17] File exists: '/Applications/web2py/applications/admin/databases' Is there any file where I should enable the applications? On Tuesday, January 28, 2014 3:31:18 AM UTC+1, Dave S wrote: On Sunday, January 26, 2014 10:40:16 AM UTC-8, Wonton wrote: Looking at this and seeing that it tries to access admin.py, maybe it was a bad decision to remove the admin application? How could I enable cloneofmyapplication in the server? Do you still have the welcome app? Perhaps you could copy that, and then put your cloneofapp code on top of it. /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How to change password Too short message?
When registering a new user using the default Auth forms, if the password entered is too short, an error message Too short is displayed. I would like to change this message to something more meaningful such as Password must be at least x characters 1. How do I do this? 2. Shouldn't the default message be something like this? Seems not user friendly to just say password Too short with no indication to the user how long a password should be. Are they just supposed to keep entering passwords until they hit whatever arbitrary password length we have set? Alternatively, is there a way to specify a permanent hint on the form that passwords must be x characters? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Location of auth.settings statements relative to auth.define_tables?
In the welcome application, all auth.settings statements appear after auth.define_tables statement: ## create all tables needed by auth if not custom tables auth.define_tables(username=False, signature=False) ## configure email mail = auth.settings.mailer mail.settings.server = 'logging' or 'smtp.gmail.com:587' mail.settings.sender = 'y...@gmail.com' mail.settings.login = 'username:password' ## configure auth policy auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True However, some auth setting statement must occur before auth.define_tables in order to take effect (such as auth.settings.password_min_length). How do I know which ones need to come before or after auth.define_tables? Or can/should they all come before auth.define_tables? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Do I need to set auth.settings.hmac_key?
Is best practice to set auth.settings.hmac_key='sha512:somelongpassword'? Or is this not necessary? And if I should do it, does it need to be done before auth.define_tables? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Wiki.auth 401 error
I also got the 401 error (version 2.8.2, Windows) when I first installed the wiki. After comparing with a previous version (2.7.4), it looks like in version 2.8.2, the wiki_editor group is not automatically created in db.auth_group. The wiki works fine when the group is added in and the user is assigned membership to the group (through appadmin). On Saturday, 11 January 2014 06:06:14 UTC-5, Alan Etkin wrote: Pretty much give up on this, the wiki looked very promising when i first tried it, seems to be dead now, Still unable to reproduce the issue with Version 2.8.2-stable+timestamp.2014.01.09.11.46.01 in development. Mind that you must have permission to create wikis. Check that there is a wiki_editor or wiki_author membership in the app database applied to your user. Also check that when creating the app in development, you have access to the admin app, otherwise the automatic permission creation can fail. If you think this is an environment specific problem, file an issue at http://code.google.com/p/web2py and we'll try to fix it asap. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Location of auth.settings statements relative to auth.define_tables?
You can probably safely put most of them before define_tables. However, I don't think many actually have to come before define_tables, other than password_min_length, and obviously the ones that set the table names (maybe a couple others). You can always look at the .define_tables method code and see which settings are used there. Anthony On Tuesday, January 28, 2014 5:08:57 PM UTC-5, User wrote: In the welcome application, all auth.settings statements appear after auth.define_tables statement: ## create all tables needed by auth if not custom tables auth.define_tables(username=False, signature=False) ## configure email mail = auth.settings.mailer mail.settings.server = 'logging' or 'smtp.gmail.com:587' mail.settings.sender = 'y...@gmail.com' mail.settings.login = 'username:password' ## configure auth policy auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True However, some auth setting statement must occur before auth.define_tables in order to take effect (such as auth.settings.password_min_length). How do I know which ones need to come before or after auth.define_tables? Or can/should they all come before auth.define_tables? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Is there a way to cache images from download function?
I'm exploring options. I want to be able to cache my images. Client side, server side it doesn't matter. What is the best method to go about this? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to change password Too short message?
On Tuesday, January 28, 2014 4:46:27 PM UTC-5, User wrote: When registering a new user using the default Auth forms, if the password entered is too short, an error message Too short is displayed. I would like to change this message to something more meaningful such as Password must be at least x characters 1. How do I do this? db.auth_user.password.requires[0].error_message = 'Password must be at least x characters' 2. Shouldn't the default message be something like this? Seems not user friendly to just say password Too short with no indication to the user how long a password should be. Are they just supposed to keep entering passwords until they hit whatever arbitrary password length we have set? Yes, good idea. Please open an issue on Google Code. Alternatively, is there a way to specify a permanent hint on the form that passwords must be x characters? It would probably be a good idea to add this by default as well. You can do it manually via: db.auth_user.password.comment = 'Password must be...' Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to change password Too short message?
Thanks, issue created: http://code.google.com/p/web2py/issues/detail?id=1863 On Tuesday, January 28, 2014 6:57:35 PM UTC-5, Anthony wrote: On Tuesday, January 28, 2014 4:46:27 PM UTC-5, User wrote: When registering a new user using the default Auth forms, if the password entered is too short, an error message Too short is displayed. I would like to change this message to something more meaningful such as Password must be at least x characters 1. How do I do this? db.auth_user.password.requires[0].error_message = 'Password must be at least x characters' 2. Shouldn't the default message be something like this? Seems not user friendly to just say password Too short with no indication to the user how long a password should be. Are they just supposed to keep entering passwords until they hit whatever arbitrary password length we have set? Yes, good idea. Please open an issue on Google Code. Alternatively, is there a way to specify a permanent hint on the form that passwords must be x characters? It would probably be a good idea to add this by default as well. You can do it manually via: db.auth_user.password.comment = 'Password must be...' Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Unable to acces admin app in production
Yes I did a backup before. I updated from 2.3 to 2.8.2. The only way I found to get the admin work again is to remove the web2py folder before unzipping the new version. I had the same problem with my local version. I'll take a look to your post... Thanks. On Monday, January 27, 2014 8:46:59 PM UTC-5, Richard wrote: Did you backup before? You probably need to update a couple of file that are web2py specific in static/ all the js, in views/ the generic views and the web2py_ajax also in you case the appadmin.py controller must be update... You migrate from which version... If you search the list there is a post from me about all the app files that should be update on web2py update... Richard On Fri, Jan 24, 2014 at 8:48 PM, Julien Courteau courtea...@gmail.comjavascript: wrote: After I tried to upgrade to version 2.8.2-stable 2013.11.23 13.54.07 from the admin application (the upgrade button), I no longer have access to the admin app: the ticket produced refer to an import error concerning gluon.tools.Config from the admin/default.py controller. I tried to upgrade manually with the same result. The site is till accessible as usual. Any clue? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: web2py and python 3.3 ?
I go to try it template.py and dal.py 2014-01-28 Massimo Di Pierro massimo.dipie...@gmail.com Those are too old. I suggest you adopt a module and the time (start with template.py) and port that. On Monday, 27 January 2014 17:23:42 UTC-6, kevin cloinger wrote: On Saturday, June 16, 2012 4:26:06 PM UTC-7, Massimo Di Pierro wrote: There is a fork of web2py that works on 3.3 but this is not a feature we want to officially support or advertise. It will break almost all of existing apps. massimo On Saturday, 16 June 2012 17:17:55 UTC-5, samuel bonilla wrote: web2py 2.0 will supports python 3.3 ? Where is the python3 fork so start with that version? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/T_uhbRQSXNU/unsubscribe. 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. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Blocking/lockout for excessive login attempts?
Does web2py have any ability to block too many login attempts from occurring perhaps by locking the user out? Or showing a captcha after x login tries? Or some other feature to mitigate brute force password attempts? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] What is the purpose of the ABOUT file in an application?
In the welcome application there is an ABOUT file whose contents are: Write something about this app. Developed with web2py. What's the intended purpose of this file and is it protected from end users' viewing? Is this for developers? Also is the LICENSE file protected from end user viewing? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Wiki.auth 401 error
Any chance for steps on how to do that ? (For us that are new o web2py) -wa On Jan 28, 2014, at 5:28 PM, galoshes moquin...@gmail.com wrote: I also got the 401 error (version 2.8.2, Windows) when I first installed the wiki. After comparing with a previous version (2.7.4), it looks like in version 2.8.2, the wiki_editor group is not automatically created in db.auth_group. The wiki works fine when the group is added in and the user is assigned membership to the group (through appadmin). On Saturday, 11 January 2014 06:06:14 UTC-5, Alan Etkin wrote: Pretty much give up on this, the wiki looked very promising when i first tried it, seems to be dead now, Still unable to reproduce the issue with Version 2.8.2-stable+timestamp.2014.01.09.11.46.01 in development. Mind that you must have permission to create wikis. Check that there is a wiki_editor or wiki_author membership in the app database applied to your user. Also check that when creating the app in development, you have access to the admin app, otherwise the automatic permission creation can fail. If you think this is an environment specific problem, file an issue at http://code.google.com/p/web2py and we'll try to fix it asap. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/IUjoJrddE4Y/unsubscribe. 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. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Pattern-based Application-Specific URL rewrite basic example?
My web2py-root/routes.py currently has: # -*- coding: utf-8 -*- # default_application, default_controller, default_function # are used when the respective element is missing from the # (possibly rewritten) incoming URL # default_application = 'init'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py # routes_app is a tuple of tuples. The first item in each is a regexp that will # be used to match the incoming request URL. The second item in the tuple is # an applicationname. This mechanism allows you to specify the use of an # app-specific routes.py. This entry is meaningful only in the base routes.py. # # Example: support welcome, admin, app and myapp, with myapp the default: routes_app = ((r'/(?Pappwelcome|admin|app)\b.*', r'\gapp'), (r'(.*)', r'myapp'), (r'/?(.*)', r'myapp')) ... For a basic example of routing www.example.com/someapp/default/contact to www.example.com/contact what needs to go in the web2py-root/routes.py and what needs to go in the web2py-root/applications/someapp/routes.py? If I'm using application specific routing does this mean I should leave routes_in and routes_out completely alone in web2py-root/routes.py? Also for specifying errors, do I use routes_onerror in web2py-root/routes.py or web2py-root/applications/someapp/routes.py? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Blocking/lockout for excessive login attempts?
Nothing built in, though the admin app does have something like that if you want to look at the code. On Tuesday, January 28, 2014 9:41:38 PM UTC-5, User wrote: Does web2py have any ability to block too many login attempts from occurring perhaps by locking the user out? Or showing a captcha after x login tries? Or some other feature to mitigate brute force password attempts? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Selects as_trees
Hi I am looking for a way to expand all referenced fields and have read about the as_trees() method for selecting rows. I do not quite understand the parent field requirement, but say we have the following tables/relationships, was looking for a nested dict output which could be JSONified as follows: db.define_table('customers', Field('name'), Field('email'), Field('address') ) db.define_table('products', Field('name'), Field('description') ) db.define_table('orders', Field('customer', db.customers), Field('order_date', 'date'), Field('discount', 'double') ) db.define_table('orders_line', Field('order', db.orders), Field('product', db.products), Field('price', 'double'), Field('qty', 'double') ) db(db.orders_line.order==123).select().as_trees() would give [{'order':{'id':123, 'customer':{'id':1, 'name':'Bob', 'email': 'b...@demo.com', 'address':None}, 'order_date':'2014/01/29', 'discount': 0}, 'product':{'id':1, 'name':'desk', 'description':'Wood finish, 4-legs'}, 'price':100.0, 'qty': 1.0}] I get the following error: *** AttributeError: AttributeError('Row' object has no attribute 'id',) Any suggestions? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: caching TAG()
Thanks Anthony. It still appears to be returning the string result rather than the HTML object - even for the first time the function is called (uncached). I have cleared the cache (using redis cache). On Monday, 27 January 2014 23:38:30 UTC+8, Anthony wrote: Don't use XML() in your SMALL definition. Instead, create the entire HTML helper object, call the .xml() method, store the resulting string in the cache, and then after retrieving from cache, use XML() to display the string in a view. For example: myoutput = XML(cache.disk('Hello', lambda: CAT(P('Hello'), TAG.small( 'World')).xml(), time_expire=100)) {{=myoutput}} On Monday, January 27, 2014 10:06:59 AM UTC-5, Calvin wrote: Thanks Leonel-I tried this without any success. It still rendering incorrectly but this time consistently before and after caching. On Tuesday, 21 January 2014 03:34:39 UTC+8, Leonel Câmara wrote: You can use {{=XML(output, sanitize=False)}} to get the correct rendering -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Querying rows over several many-to-many tables.
I want to search across some many to many tables, but with certain conditions. db.define_table('person', Field('name', 'string'), Field('nickname', 'string')) db.define_table('clothing', Field('name', 'string')) db.define_table('item', Field('name', 'string')) db.define_table('item_person', Field('person_id', 'reference person'), Field('item_id', 'reference item')) db.define_table('clothing_person', Field('person_id', 'reference person'), Field('clothing_id', 'reference clothing')) How would I find all people who have the name 'Bob' or nickname 'Bobcat' AND have items called 'item1' and 'item2' AND have clothing 'clothing1' ? For example, these are valid results: Bob has item1, item2 and clothing1 Bobcat has item1, item2 and clothing1 Would I use a join for this? Maybe something like: db( (db.person.name.like('Bob')) | (db.person.name.like('Bobcat')).select(db.person.ALL, join=[ db.item_person.on( (db.item.id==db.item_person.item_id) ((db.item.name=='item1') (db.item.name='item2'))), db.clothing_person.on( (db.clothing.id==db.clothing_person.clothing_id) (db.clothing.name=='clothing1')) ]) But that doesn't seem correct. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: caching TAG()
On Wednesday, January 29, 2014 12:19:54 AM UTC-5, Calvin wrote: Thanks Anthony. It still appears to be returning the string result rather than the HTML object - even for the first time the function is called (uncached). I have cleared the cache (using redis cache). Not sure what you mean. The value stored in the cache is always a string (even when there's nothing yet in the cache, the value created to be stored in the cache must be a string). When the value is created or retrieved from the cache, it is then wrapped in XML(), so the myoutput variable is an XML object. At no point do you have a standard HTML helper. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: caching TAG()
Yes-you are right. I had meant XML object, but the issue still persists. Even with the XML() function wrapping the cache output, the output rendered on the browser is a string with the tags printed. In this case, this always appears while previously, it would only occur after the cache has been filled. Perplexed! On Wednesday, 29 January 2014 14:12:05 UTC+8, Anthony wrote: On Wednesday, January 29, 2014 12:19:54 AM UTC-5, Calvin wrote: Thanks Anthony. It still appears to be returning the string result rather than the HTML object - even for the first time the function is called (uncached). I have cleared the cache (using redis cache). Not sure what you mean. The value stored in the cache is always a string (even when there's nothing yet in the cache, the value created to be stored in the cache must be a string). When the value is created or retrieved from the cache, it is then wrapped in XML(), so the myoutput variable is an XML object. At no point do you have a standard HTML helper. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.