[web2py] PostgreSQL super slowdowns
Hey, I've noticed some serious slowdowns ever since I switched from SQLite to Postgres. Pages will take MINUTES to load - it's kind of fascinating. I don't have the full explanation for what's going on yet but I do have some clues. I've noticed it happens locally, and in a specific way: 1) I load the page up in one browser and it loads and reloads fine. 2) When I open the page up in another browser or in an incognito session on the same machine, the page request hangs, usually for longer than two minutes. I don't know for sure that it's Postgres related, but I don't remember seeing this on SQLite. This is something I really need to fix! Can anyone reproduce this? Are there profilers or particular places in the code I can tag? Thanks! - Chris
[web2py] Re: Some beginner questions on form
Yes, you can use dictionary to define values e.g. Field( 'name',requires=IS_IN_SET({'key1':'label1','key2':'label2','key3':'label3'}) ) David On 29 říj, 02:30, pierreth pierre.thibau...@gmail.com wrote: On 27 oct, 23:10, mdipierro mdipie...@cs.depaul.edu wrote: Field('name',requires=IS_IN_SET(('value1,'value2',value3'))) This is cool. Can I have valuex in the db while presenting something else to the user (I want to value in my db to be always in English but I need to translate these values for the user) without having to do a conversion function that will translate values send my the form to English?
[web2py] Making reference fields optional
Hi, Just wondering if it's possible to have fields that optionally reference other fields? For example, I have the below table defined: # Message model db.define_table('message', Field('sender', custom_auth_table, writable=False, required=True, notnull=True), Field('recipient', custom_auth_table, writable=False, requires=[], required=True, ondelete=NO ACTION), Field('text', 'string', length=2048, required=True, notnull=True), Field('created', 'datetime', default=request.now, writable=False, notnull=True) ) However, a Message, doesn't always have a specific 'recipient', ie. it could be a broadcast message to all users. In this case, I would like to store NULL or 0 as the field value. However, when I try to save None | 'NULL' | 0 to the field, I get the error below: IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`roverus`.`message`, CONSTRAINT `message_ibfk_2` FOREIGN KEY (`recipient`) REFERENCES `auth_user` (`id`) ON DELETE NO ACTION)') Would anyone have any tips on how I might go about achieving this? Cheers Ruiwen
[web2py] Is CRON working if web2py is running as a windows service?
Is CRON working if web2py is running as a windows service?
[web2py] autocomplete widget and queries
Is it possible to use the autocomplete widget with the values dependent of what has been entered in another field. eg. db.define_table('example', -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: autocomplete widget and queries
Apologies, I pressed some key that sent the email before it was finished: Using the model db.define_table('example', Field(' surname'), Field('name')) as the autocomplete widget's reference table containing the following data surname name Black Petro GrayPeter White Paul I want the autocomplete widget on 'name' to only show 'Paul' if 'White' was entered in the 'surname' field. How do I do it? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] default=False on boolean Field
Hi, I'm running into a little problem with boolean Field in my model. I have: db.define_table('message', Field('sender', custom_auth_table, writable=False, required=True, notnull=True), Field('text', 'string', length=2048, required=True, notnull=True), Field('is_read', 'boolean', default=False, notnull=True), format='%(msg_type)s by %(sender)s: %(text)s on %(created)s' ) I'd like Messages to be unread by default, hence 'default=False' on the 'is_read' field. As expected, in appadmin, that gives me un unchecked checkbox. However, when trying to save the model in appadmin (and presumably other instances with forms validated by SQLFORM), I keep getting asked to input a value for that field. I'm unable to save a Message with the 'is_read' checkbox unchecked, ie. False. Am I doing something wrong here? //Ruiwen
Re: [web2py] default=False on boolean Field
How about stripping the notnull=True? If I'm right, your default=False option will replace null value by False. On Fri, Oct 29, 2010 at 8:11 AM, Ruiwen Chua rwc...@gmail.com wrote: Hi, I'm running into a little problem with boolean Field in my model. I have: db.define_table('message', Field('sender', custom_auth_table, writable=False, required=True, notnull=True), Field('text', 'string', length=2048, required=True, notnull=True), Field('is_read', 'boolean', default=False, notnull=True), format='%(msg_type)s by %(sender)s: %(text)s on %(created)s' ) I'd like Messages to be unread by default, hence 'default=False' on the 'is_read' field. As expected, in appadmin, that gives me un unchecked checkbox. However, when trying to save the model in appadmin (and presumably other instances with forms validated by SQLFORM), I keep getting asked to input a value for that field. I'm unable to save a Message with the 'is_read' checkbox unchecked, ie. False. Am I doing something wrong here? //Ruiwen
[web2py] Re: default=False on boolean Field
Right, that seems to work, thanks! I'm a little puzzled as to why these two options should conflict in this case though? Doesn't the notnull=True option simply prevent the field from holding a NULL value, while the default= option does in fact provide a value by default (hence avoiding a NULL)? On Oct 29, 6:51 pm, Vinicius Assef vinicius...@gmail.com wrote: How about stripping the notnull=True? If I'm right, your default=False option will replace null value by False. On Fri, Oct 29, 2010 at 8:11 AM, Ruiwen Chua rwc...@gmail.com wrote: Hi, I'm running into a little problem with boolean Field in my model. I have: db.define_table('message', Field('sender', custom_auth_table, writable=False, required=True, notnull=True), Field('text', 'string', length=2048, required=True, notnull=True), Field('is_read', 'boolean', default=False, notnull=True), format='%(msg_type)s by %(sender)s: %(text)s on %(created)s' ) I'd like Messages to be unread by default, hence 'default=False' on the 'is_read' field. As expected, in appadmin, that gives me un unchecked checkbox. However, when trying to save the model in appadmin (and presumably other instances with forms validated by SQLFORM), I keep getting asked to input a value for that field. I'm unable to save a Message with the 'is_read' checkbox unchecked, ie. False. Am I doing something wrong here? //Ruiwen
Re: [web2py] PostgreSQL super slowdowns
On 29 October 2010 08:53, Chris partyonais...@gmail.com wrote: Hey, I've noticed some serious slowdowns ever since I switched from SQLite to Postgres. Pages will take MINUTES to load - it's kind of fascinating. I have been using both SQLITE and Postgresql (sometimes with the same content) and did not notice a slowdown. Some of my datasets are quite large (a dump of a present project's database is about 3G) and I don't experience any problem on Postgresql. What exactly were you doing when you noticed this? Inserts? Queries? CSV-downloads? How much data? How much ram available? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: web2py sandbox
1: Is it possible on GAE? (if not, no problem I can host) I would not know how to maintain state since you cannot cache in ram. You an serialize the state but not functions and classes definitions. 2: Is it safe? how to make it safe? Yes except that you have total access to datastore. 3: Can we have multi access? This is not a problem if you can figure out 1.
[web2py] Re: Quiet here tonight
Thanks. It seems lots of people are interested in web2py here in Argentina. On Oct 29, 12:34 am, ron_m ron.mco...@gmail.com wrote: Massimo, your users of web2py wish you a safe and successful trip spreading the good word about web2py.
[web2py] Re: Making reference fields optional
What database? On Oct 29, 3:05 am, Ruiwen Chua rwc...@gmail.com wrote: Hi, Just wondering if it's possible to have fields that optionally reference other fields? For example, I have the below table defined: # Message model db.define_table('message', Field('sender', custom_auth_table, writable=False, required=True, notnull=True), Field('recipient', custom_auth_table, writable=False, requires=[], required=True, ondelete=NO ACTION), Field('text', 'string', length=2048, required=True, notnull=True), Field('created', 'datetime', default=request.now, writable=False, notnull=True) ) However, a Message, doesn't always have a specific 'recipient', ie. it could be a broadcast message to all users. In this case, I would like to store NULL or 0 as the field value. However, when I try to save None | 'NULL' | 0 to the field, I get the error below: IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`roverus`.`message`, CONSTRAINT `message_ibfk_2` FOREIGN KEY (`recipient`) REFERENCES `auth_user` (`id`) ON DELETE NO ACTION)') Would anyone have any tips on how I might go about achieving this? Cheers Ruiwen
[web2py] Re: Is CRON working if web2py is running as a windows service?
It should. On Oct 29, 3:59 am, Sverre sverreodeg...@gmail.com wrote: Is CRON working if web2py is running as a windows service?
[web2py] Re: default=False on boolean Field
You are right. That is a bug. I will fix it. On Oct 29, 6:01 am, Ruiwen Chua rwc...@gmail.com wrote: Right, that seems to work, thanks! I'm a little puzzled as to why these two options should conflict in this case though? Doesn't the notnull=True option simply prevent the field from holding a NULL value, while the default= option does in fact provide a value by default (hence avoiding a NULL)? On Oct 29, 6:51 pm, Vinicius Assef vinicius...@gmail.com wrote: How about stripping the notnull=True? If I'm right, your default=False option will replace null value by False. On Fri, Oct 29, 2010 at 8:11 AM, Ruiwen Chua rwc...@gmail.com wrote: Hi, I'm running into a little problem with boolean Field in my model. I have: db.define_table('message', Field('sender', custom_auth_table, writable=False, required=True, notnull=True), Field('text', 'string', length=2048, required=True, notnull=True), Field('is_read', 'boolean', default=False, notnull=True), format='%(msg_type)s by %(sender)s: %(text)s on %(created)s' ) I'd like Messages to be unread by default, hence 'default=False' on the 'is_read' field. As expected, in appadmin, that gives me un unchecked checkbox. However, when trying to save the model in appadmin (and presumably other instances with forms validated by SQLFORM), I keep getting asked to input a value for that field. I'm unable to save a Message with the 'is_read' checkbox unchecked, ie. False. Am I doing something wrong here? //Ruiwen
Re: [web2py] Looking for a developer - Web2py and Google App engine simple project
* www.ksrista.com search your life partner*
Re: [web2py] Re: Some beginner questions on form
* www.ksrista.com search your life partner*
Re: [web2py] Quiet here tonight
* www.ksrista.com search your life partner*
[web2py] Add Future Expires Headers.
To improve the performance of my site someone advised me to Add Future Expires Headers. The instruction to do so reads like: This goes in your root .htaccess file but if you have access to httpd.conf that is better. This code uses the FilesMatch directive and the Header directive to add Future Expires Headers to certain files. FilesMatch \.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$ Header set Expires Thu, 15 Apr 2010 20:00:00 GMT /FilesMatch I asked the people at webfaction how to proceed, their reply reads like: You cannot access the httpd.conf for the main server so you will need to set this on the backend in your httpd.conf for your web2py app. Any far out date will be fine for the date. Has one of you done this? and where in web2py would they file go? Kind regard, Annet.
[web2py] .represent and jqgrid
The following works: db.teacher.id.represent = lambda id: A('edit',_href=URL(r=request,c='default',f='edit_teacher',args=str(id))) and the following not: db.school.id.represent = lambda id: db.school(id).name db.school.id is shown in jqgrid. How do I get the School name to show up in jqgrid? -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Record Versioning findings
First of all, CRUD is the hell of a productivity tool. Some findings: 1. Definiton of the archive table like given in the book: db.define_table('mytable_arcvhive', Field('current_record',db.mytable), db.mytable) breaks deletion of records in db.mytable. The foreign key constraint in db.mytable_archive prevents a deletion. Untested workaround proposal: db.define_table('mytable_arcvhive', Field('current_record', integer), db.mytable) 2. Any unique constraint on db.mytable breaks archiving on modifying the record without changing the unique constraint column. Unique constraints have to be manually removed from db.mytable_archive currently. Any plans to automate? 3. In the documentation the archive table is defined like db.define_table('mytable_history', Field('current_record',db.mytable), db.mytable) while in the current version it is defined like db.define_table('mytable_arcvhive', Field('current_record',db.mytable), db.mytable) Just a typo correction needed in the documentation. Regards, Andreas balo...@gmail.com
[web2py] update_record() failing on user record
When I try and do an update_record() I get an exception. Is there something wrong with my table definition? Can anyone help? From db.py: auth.settings.table_user = db.define_table( auth.settings.table_user_name, db.Field('email', 'string', length=254, unique=True, notnull=True, required=True, requires = [IS_LOWER(), IS_EMAIL(), IS_NOT_IN_DB(db,'%s.email'%auth.settings.table_user_name)]), db.Field('password', 'password', length=512, readable=False, label='Password', requires = [CRYPT(key='***')]), db.Field('registration_id', length=512, writable=False, readable=False, default=''), db.Field('registration_key', length=512, writable=False, readable=False, default=''), db.Field('first_name', 'string', length=128), db.Field('last_name', 'string', length=128)) The rest is in default.py: registerAgent(form) def registerLinkedInAgent(): if auth.user.registration_key and len(auth.user.registration_key): # one-off calls auth.add_membership(auth.id_group( 'agent'), auth.user.id) # find current user's record and update registration key to an empty string so this code isn't called again users = db(db.auth_user.id==auth.user.id).select(db.auth_user.ALL) if users and len(users): users[0].update_record({'registration_key''}) redirect(URL('account')) The problem is I get ValueError: need more than 1 value to unpack when I call update_record() Full trackback is below: Traceback (most recent call last): File E:\projects\workspace\TestEnvoy\web2py\gluon\restricted.py, line 188, in restricted exec ccode in environment File E:/projects/workspace/TestEnvoy/web2py/applications/init/ controllers/default.py, line 1528, in module File E:\projects\workspace\TestEnvoy\web2py\gluon\globals.py, line 96, in lambda self._caller = lambda f: f() File E:/projects/workspace/TestEnvoy/web2py/applications/init/ controllers/default.py, line 1132, in registerLinkedInAgent users[0].update_record({'registration_key' : ''}) File E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py, line 3381, in lambda colset.update_record = lambda _ = (colset, table, id), **a: update_record(_, a) File E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py, line 3508, in update_record (colset, table, id) = pack ValueError: need more than 1 value to unpack
Re: [web2py] Re: web2py sandbox
May we could maintain state on GAE Database, I did an example running on my host, but I dont know how to protect the access for some dangerous modules as glob, sys, os, etc.. The right way to do it is to using a Java Script or Flash Python/API interpreter. 2010/10/29 mdipierro mdipie...@cs.depaul.edu 1: Is it possible on GAE? (if not, no problem I can host) I would not know how to maintain state since you cannot cache in ram. You an serialize the state but not functions and classes definitions. 2: Is it safe? how to make it safe? Yes except that you have total access to datastore. 3: Can we have multi access? This is not a problem if you can figure out 1. -- http://rochacbruno.com.br
[web2py] Reference to the mapping table - No drop down in admin interface
Hi, I have the following table structure in my db.py. db.define_table('table_a', Field('x_id', db.table_x), Field('name', length=200, required=True), Field('description', length=300), Field('displayorder', 'integer', required=True), format='%(name)s') db.define_table('table_b', Field('name', length=45, required=True), Field('description', length=200), format='%(name)s') db.define_table('a_b', Field('a_id', db.table_a), Field('b_id', db.table_b), Field('displayorder', 'integer', required=True), format='%(id)s') db.define_table('user', Field('user_id', 'integer', required=True), Field('name', length=60, required=True), format='%(name)s') db.define_table('table_c', Field('a_b_id', db.a_b), Field('user_id', db.user), Field('content', 'text', required=True), Field('content', 'text', required=True)) db.table_c.a_b_id.requires = IS_NOT_IN_DB(db, db.a_b) Here, 'table_a' and 'table_b' have many to many mapping. Table 'a_b' is the mapping table. Now in 'table_c', I am referring to table 'a_b'. (the mapping table) While inserting into 'table_c', I am not getting the drop down for the 'a_b_id' column. But for the 'user_id' column, I am getting the drop down. I am not sure where things are going wrong. Any help is appreciated. Ideally I would like the combination of a.name and b.name in the drop down for 'a_b_id' in the 'table_c' By the way, web2py is an amazing piece of work. So far my experience has been great. Thanks, Steve.
Re: [web2py] Re: Remove link in MENU for current url
Massimo, I tried sending this patch directly to you, but I'm not sure if you received it. In any case, I re-exported the patch this morning so it runs against trunk. Let me know if I've missed something or if you've decided to hold this out of the framework. I won't be offended either way. Thanks, Mike On Fri, Oct 22, 2010 at 4:38 PM, mdipierro mdipie...@cs.depaul.edu wrote: Can you please email me the patch? thanks. On Oct 22, 3:08 pm, Michael Wolfe michael.joseph.wo...@gmail.com wrote: Following the sage advice of Jakob Nielsen, I wanted a way to turn off links that point to the current page within the menu (see #10 here:http://www.useit.com/alertbox/20031110.html). At the bottom of this e-mail, I'm including a proposed patch that would make this easier. I've added two optional parameters to the MENU helper: no_link_url and active_url. To illustrate how this works, I'll give three examples of what you would see for the Index link in the welcome scaffolding app by altering the MENU line from layout.html. 1. Current behavior {{=MENU(response.menu,_class='sf-menu')}} lia href=/welcome/default/indexIndex/a/li 2. Removing the link for the current page {{=MENU(response.menu,_class='sf-menu',no_link_url=request.url)}} lidivIndex/div/li 3. Adding the class 'active' to the list item of the link to the current page {{=MENU(response.menu,_class='sf-menu',active_url=request.url, li_active='active')}} li class=activea href=/welcome/default/indexIndex/a/li And here's the patch. Please let me know if I've missed something. diff -r 6608e0e6b4f3 -r badb5215df3f applications/welcome/static/base.css --- a/applications/welcome/static/base.css Fri Oct 15 07:17:35 2010 -0500 +++ b/applications/welcome/static/base.css Fri Oct 22 15:11:06 2010 -0400 @@ -216,9 +216,12 @@ .sf-menu { float: left; } -.sf-menu a { +.sf-menu a, .sf-menu div { padding: 5px 15px; } +.sf-menu div { + color: white; +} .sf-menu li { background: #33; } diff -r 6608e0e6b4f3 -r badb5215df3f gluon/html.py --- a/gluon/html.py Fri Oct 15 07:17:35 2010 -0500 +++ b/gluon/html.py Fri Oct 22 15:11:06 2010 -0400 @@ -1699,14 +1699,16 @@ ul = UL(_class=self['ul_class']) for item in data: (name, active, link) = item[:3] - if link: + if 'no_link_url' in self.attributes and self['no_link_url']==link: + li = LI(DIV(name)) + elif link: li = LI(A(name, _href=link)) else: li = LI(A(name, _href='#null')) if len(item) 3 and item[3]: li['_class'] = self['li_class'] li.append(self.serialize(item[3], level+1)) - if active: + if active or 'active_url' in self.attributes and self['active_url']==link: if li['_class']: li['_class'] = li['_class']+' '+self['li_active'] else: web2py_rev1091.patch Description: Binary data
[web2py] Re: jQuery Tools
Note to self, reply posts don't show up immediately :) On Oct 28, 3:59 pm, RipRyness ripryn...@gmail.com wrote: I've been using jQuery UI but these look very cool. Thanks for the link. -Rip PS I must have hit reply to author on my previous try at responding to this post. On Oct 28, 1:23 pm, Bruno Rocha rochacbr...@gmail.com wrote: I am using jQuery tools with web2py I think it is the best/easiest way to have a great visual style for tabs, menus, datepickers etc Could be useful for someone else:http://flowplayer.org/tools/index.html Demos:http://flowplayer.org/tools/demos/index.html
[web2py] Re: Some beginner questions on form
On 29 oct, 03:22, David Marko dma...@tiscali.cz wrote: Yes, you can use dictionary to define values e.g. Field( 'name',requires=IS_IN_SET({'key1':'label1','key2':'label2','key3':'label3'}) ) David I'm beginning to really like web2py I think!
[web2py] Re: update_record() failing on user record
This doesn't look very well formed: users[0].update_record({'registration_key''}) See the manual example... rows=db(db.person.id2).select() row=rows[0] row.update_record(name='Curt') http://www.web2py.com/book/default/chapter/06?search=update_record -D On Oct 29, 3:32 pm, Carl carl.ro...@gmail.com wrote: When I try and do an update_record() I get an exception. Is there something wrong with my table definition? Can anyone help? From db.py: auth.settings.table_user = db.define_table( auth.settings.table_user_name, db.Field('email', 'string', length=254, unique=True, notnull=True, required=True, requires = [IS_LOWER(), IS_EMAIL(), IS_NOT_IN_DB(db,'%s.email'%auth.settings.table_user_name)]), db.Field('password', 'password', length=512, readable=False, label='Password', requires = [CRYPT(key='***')]), db.Field('registration_id', length=512, writable=False, readable=False, default=''), db.Field('registration_key', length=512, writable=False, readable=False, default=''), db.Field('first_name', 'string', length=128), db.Field('last_name', 'string', length=128)) The rest is in default.py: registerAgent(form) def registerLinkedInAgent(): if auth.user.registration_key and len(auth.user.registration_key): # one-off calls auth.add_membership(auth.id_group( 'agent'), auth.user.id) # find current user's record and update registration key to an empty string so this code isn't called again users = db(db.auth_user.id==auth.user.id).select(db.auth_user.ALL) if users and len(users): users[0].update_record({'registration_key''}) redirect(URL('account')) The problem is I get ValueError: need more than 1 value to unpack when I call update_record() Full trackback is below: Traceback (most recent call last): File E:\projects\workspace\TestEnvoy\web2py\gluon\restricted.py, line 188, in restricted exec ccode in environment File E:/projects/workspace/TestEnvoy/web2py/applications/init/ controllers/default.py, line 1528, in module File E:\projects\workspace\TestEnvoy\web2py\gluon\globals.py, line 96, in lambda self._caller = lambda f: f() File E:/projects/workspace/TestEnvoy/web2py/applications/init/ controllers/default.py, line 1132, in registerLinkedInAgent users[0].update_record({'registration_key' : ''}) File E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py, line 3381, in lambda colset.update_record = lambda _ = (colset, table, id), **a: update_record(_, a) File E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py, line 3508, in update_record (colset, table, id) = pack ValueError: need more than 1 value to unpack
Re: [web2py] Re: update_record() failing on user record
thank you for responding. my error is editing the code in the posting (which I tell myself I should never do!) I actually have: users[0].update_record({'registration_key'' : ''}) but even that is crazy talk and you are right, the following is correct... users[0].update_record(registration_key='') thanks for your help. I just couldn't see the problem for want of staring. On 29 October 2010 17:20, villas villa...@gmail.com wrote: This doesn't look very well formed: users[0].update_record({'registration_key''}) See the manual example... rows=db(db.person.id2).select() row=rows[0] row.update_record(name='Curt') http://www.web2py.com/book/default/chapter/06?search=update_record -D On Oct 29, 3:32 pm, Carl carl.ro...@gmail.com wrote: When I try and do an update_record() I get an exception. Is there something wrong with my table definition? Can anyone help? From db.py: auth.settings.table_user = db.define_table( auth.settings.table_user_name, db.Field('email', 'string', length=254, unique=True, notnull=True, required=True, requires = [IS_LOWER(), IS_EMAIL(), IS_NOT_IN_DB(db,'%s.email'%auth.settings.table_user_name)]), db.Field('password', 'password', length=512, readable=False, label='Password', requires = [CRYPT(key='***')]), db.Field('registration_id', length=512, writable=False, readable=False, default=''), db.Field('registration_key', length=512, writable=False, readable=False, default=''), db.Field('first_name', 'string', length=128), db.Field('last_name', 'string', length=128)) The rest is in default.py: registerAgent(form) def registerLinkedInAgent(): if auth.user.registration_key and len(auth.user.registration_key): # one-off calls auth.add_membership(auth.id_group( 'agent'), auth.user.id) # find current user's record and update registration key to an empty string so this code isn't called again users = db(db.auth_user.id==auth.user.id).select(db.auth_user.ALL) if users and len(users): users[0].update_record({'registration_key''}) redirect(URL('account')) The problem is I get ValueError: need more than 1 value to unpack when I call update_record() Full trackback is below: Traceback (most recent call last): File E:\projects\workspace\TestEnvoy\web2py\gluon\restricted.py, line 188, in restricted exec ccode in environment File E:/projects/workspace/TestEnvoy/web2py/applications/init/ controllers/default.py, line 1528, in module File E:\projects\workspace\TestEnvoy\web2py\gluon\globals.py, line 96, in lambda self._caller = lambda f: f() File E:/projects/workspace/TestEnvoy/web2py/applications/init/ controllers/default.py, line 1132, in registerLinkedInAgent users[0].update_record({'registration_key' : ''}) File E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py, line 3381, in lambda colset.update_record = lambda _ = (colset, table, id), **a: update_record(_, a) File E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py, line 3508, in update_record (colset, table, id) = pack ValueError: need more than 1 value to unpack
[web2py] Re: Some beginner questions on form
requires=IS_IN_SET({'key1':'label1','key2':'label2','key3':'label3'}) @David - thanks for reminding us of this. Book editors please note... The fact that IS_IN_SET can accept a dict should be in the Book? (Please forgive me if I missed it there!). -D
[web2py] web2py 1.88.1 is OUT
Give it a try... Changelog ## 1.88.1 - better list: string support, thanks Bob - jquery 1.4.3 - scripts/autoroutes.py - new admin wizard - added retrieve_username to navbar (if username) - internal rewrite for arbitrary paths (abspath), thanks Jonathan - populate support for list: and decimal, thanks Chirstian - markmin2latex has extra attribute - better mercual admin allows list of files, versions and retrieve - new error report system, thanks Thadeus and Selecta - SQLFORM.accepts(detect_record_change).record_changed - fixed cron for bytecode compiled apps, thanks Álvaro J. Iradier Muro - other bugs fixes and pep8 compliant fixes
[web2py] web2py 1.88.1 is OUT
Give it a try... Changelog ## 1.88.1 - better list: string support, thanks Bob - jquery 1.4.3 - scripts/autoroutes.py - new admin wizard - added retrieve_username to navbar (if username) - internal rewrite for arbitrary paths (abspath), thanks Jonathan - populate support for list: and decimal, thanks Chirstian - markmin2latex has extra attribute - better mercual admin allows list of files, versions and retrieve - new error report system, thanks Thadeus and Selecta - SQLFORM.accepts(detect_record_change).record_changed - fixed cron for bytecode compiled apps, thanks Álvaro J. Iradier Muro - other bugs fixes and pep8 compliant fixes
[web2py] Loading component with vars
In one of my views, I loaded a component using: {{=LOAD('comment', 'conversation_dropdown.load', vars={'dashboard':True}, ajax=False)}} In the action: def conversation_download(): return{'test':request.vars.dashboard} In conversation_dropdown.load, {{=test}} evaluates to none. Have I gotten the syntax wrong somewhere?
[web2py] Re: Loading component with vars
I am not sure this works unless you do it with ajax=True. I need to check. On Oct 29, 1:50 pm, Luther Goh Lu Feng elf...@yahoo.com wrote: In one of my views, I loaded a component using: {{=LOAD('comment', 'conversation_dropdown.load', vars={'dashboard':True}, ajax=False)}} In the action: def conversation_download(): return{'test':request.vars.dashboard} In conversation_dropdown.load, {{=test}} evaluates to none. Have I gotten the syntax wrong somewhere?
[web2py] Re: Loading component with vars
Thank you. I have set ajax = True and the line works now. What is the reason for this requirement? On Oct 30, 2:52 am, mdipierro mdipie...@cs.depaul.edu wrote: I am not sure this works unless you do it with ajax=True. I need to check. On Oct 29, 1:50 pm, Luther Goh Lu Feng elf...@yahoo.com wrote: In one of my views, I loaded a component using: {{=LOAD('comment', 'conversation_dropdown.load', vars={'dashboard':True}, ajax=False)}} In the action: def conversation_download(): return{'test':request.vars.dashboard} In conversation_dropdown.load, {{=test}} evaluates to none. Have I gotten the syntax wrong somewhere?
[web2py] Re: Some beginner questions on form
It can also take a list of tuples. It will work like a dict of (key,value) but preserves sorting. On Oct 29, 11:32 am, villas villa...@gmail.com wrote: requires=IS_IN_SET({'key1':'label1','key2':'label2','key3':'label3'}) @David - thanks for reminding us of this. Book editors please note... The fact that IS_IN_SET can accept a dict should be in the Book? (Please forgive me if I missed it there!). -D
Re: [web2py] web2py 1.88.1 is OUT
Massimo, seems there are a problem with list: string, and using contains. Iam going to make an example. Or do you change anything about using contains in list string?. Because sentence like db(db.posts.keywords.contains('tag')).select() is returning nothing 2010/10/29 mdipierro mdipie...@cs.depaul.edu Give it a try... Changelog ## 1.88.1 - better list: string support, thanks Bob - jquery 1.4.3 - scripts/autoroutes.py - new admin wizard - added retrieve_username to navbar (if username) - internal rewrite for arbitrary paths (abspath), thanks Jonathan - populate support for list: and decimal, thanks Chirstian - markmin2latex has extra attribute - better mercual admin allows list of files, versions and retrieve - new error report system, thanks Thadeus and Selecta - SQLFORM.accepts(detect_record_change).record_changed - fixed cron for bytecode compiled apps, thanks Álvaro J. Iradier Muro - other bugs fixes and pep8 compliant fixes -- My blog: http://martin.tecnodoc.com.ar My portfolio *spanish*: http://www.tecnodoc.com.ar Checkout my last proyect instant-press: http://www.instant2press.com
Re: [web2py] web2py 1.88.1 is OUT
I mail you the app. this is the app *in db.py* db.define_table('posts', Field('id', 'id'), Field('title', 'string', length=255), Field('keywords', 'list:string'), migrate=True) posts = db(db.posts.id0).select() if not posts: nid=db.posts.insert(title=The Moon,keywords=['moon','space','dark']) nid=db.posts.insert(title=The Earth,keywords=['earth','blue','humans']) *in controller/default.py* posts=db(db.posts.keywords.contains('moon')).select() return dict(posts=posts) Now in this version return nothing, and in previous version work. 2010/10/29 Martín Mulone mulone.mar...@gmail.com Massimo, seems there are a problem with list: string, and using contains. Iam going to make an example. Or do you change anything about using contains in list string?. Because sentence like db(db.posts.keywords.contains('tag')).select() is returning nothing 2010/10/29 mdipierro mdipie...@cs.depaul.edu Give it a try... Changelog ## 1.88.1 - better list: string support, thanks Bob - jquery 1.4.3 - scripts/autoroutes.py - new admin wizard - added retrieve_username to navbar (if username) - internal rewrite for arbitrary paths (abspath), thanks Jonathan - populate support for list: and decimal, thanks Chirstian - markmin2latex has extra attribute - better mercual admin allows list of files, versions and retrieve - new error report system, thanks Thadeus and Selecta - SQLFORM.accepts(detect_record_change).record_changed - fixed cron for bytecode compiled apps, thanks Álvaro J. Iradier Muro - other bugs fixes and pep8 compliant fixes -- My blog: http://martin.tecnodoc.com.ar My portfolio *spanish*: http://www.tecnodoc.com.ar Checkout my last proyect instant-press: http://www.instant2press.com -- My blog: http://martin.tecnodoc.com.ar My portfolio *spanish*: http://www.tecnodoc.com.ar Checkout my last proyect instant-press: http://www.instant2press.com
[web2py] Re: Reference to the mapping table - No drop down in admin interface
Hi all, I am able to solve the issue. I just removed the following line. db.table_c.a_b_id.requires = IS_NOT_IN_DB(db, db.a_b) Now, I am getting the drop down. But the drop down shows the id of 'a_b' table. But ideally I would like the combination of a.name and b.name in the drop down for 'a_b_id' in the 'table_c'. By changing the format of 'a_b' as '%(a_id)s - %(b_id)s', I am able to show the ids combination. But I want to show the name combination to make the drop down more meaningful. Thanks, Steve. On Oct 29, 6:46 pm, Steve stephenga...@gmail.com wrote: Hi, I have the following table structure in my db.py. db.define_table('table_a', Field('x_id', db.table_x), Field('name', length=200, required=True), Field('description', length=300), Field('displayorder', 'integer', required=True), format='%(name)s') db.define_table('table_b', Field('name', length=45, required=True), Field('description', length=200), format='%(name)s') db.define_table('a_b', Field('a_id', db.table_a), Field('b_id', db.table_b), Field('displayorder', 'integer', required=True), format='%(id)s') db.define_table('user', Field('user_id', 'integer', required=True), Field('name', length=60, required=True), format='%(name)s') db.define_table('table_c', Field('a_b_id', db.a_b), Field('user_id', db.user), Field('content', 'text', required=True), Field('content', 'text', required=True)) db.table_c.a_b_id.requires = IS_NOT_IN_DB(db, db.a_b) Here, 'table_a' and 'table_b' have many to many mapping. Table 'a_b' is the mapping table. Now in 'table_c', I am referring to table 'a_b'. (the mapping table) While inserting into 'table_c', I am not getting the drop down for the 'a_b_id' column. But for the 'user_id' column, I am getting the drop down. I am not sure where things are going wrong. Any help is appreciated. Ideally I would like the combination of a.name and b.name in the drop down for 'a_b_id' in the 'table_c' By the way, web2py is an amazing piece of work. So far my experience has been great. Thanks, Steve.
[web2py] Re: Record Versioning findings
On Oct 29, 4:09 pm, baloan balo...@googlemail.com wrote: 3. In the documentation the archive table is defined like db.define_table('mytable_history', Field('current_record',db.mytable), db.mytable) while in the current version it is defined like db.define_table('mytable_arcvhive', Field('current_record',db.mytable), db.mytable) Just a typo correction needed in the documentation. The error is also in the comments section in gluon/tools.py itself, around line 2712. I have fixed the book, but the comment in the source code must still be fixed (by someone else).
[web2py] Re: web2py 1.88.1 is OUT
Fixed. 1.88.2 but please check it On Oct 29, 3:47 pm, Martín Mulone mulone.mar...@gmail.com wrote: I mail you the app. this is the app *in db.py* db.define_table('posts', Field('id', 'id'), Field('title', 'string', length=255), Field('keywords', 'list:string'), migrate=True) posts = db(db.posts.id0).select() if not posts: nid=db.posts.insert(title=The Moon,keywords=['moon','space','dark']) nid=db.posts.insert(title=The Earth,keywords=['earth','blue','humans']) *in controller/default.py* posts=db(db.posts.keywords.contains('moon')).select() return dict(posts=posts) Now in this version return nothing, and in previous version work. 2010/10/29 Martín Mulone mulone.mar...@gmail.com Massimo, seems there are a problem with list: string, and using contains. Iam going to make an example. Or do you change anything about using contains in list string?. Because sentence like db(db.posts.keywords.contains('tag')).select() is returning nothing 2010/10/29 mdipierro mdipie...@cs.depaul.edu Give it a try... Changelog ## 1.88.1 - better list: string support, thanks Bob - jquery 1.4.3 - scripts/autoroutes.py - new admin wizard - added retrieve_username to navbar (if username) - internal rewrite for arbitrary paths (abspath), thanks Jonathan - populate support for list: and decimal, thanks Chirstian - markmin2latex has extra attribute - better mercual admin allows list of files, versions and retrieve - new error report system, thanks Thadeus and Selecta - SQLFORM.accepts(detect_record_change).record_changed - fixed cron for bytecode compiled apps, thanks Álvaro J. Iradier Muro - other bugs fixes and pep8 compliant fixes -- My blog:http://martin.tecnodoc.com.ar My portfolio *spanish*:http://www.tecnodoc.com.ar Checkout my last proyect instant-press:http://www.instant2press.com -- My blog:http://martin.tecnodoc.com.ar My portfolio *spanish*:http://www.tecnodoc.com.ar Checkout my last proyect instant-press:http://www.instant2press.com
Re: [web2py] Re: web2py 1.88.1 is OUT
On Sat, Oct 30, 2010 at 12:05 AM, mdipierro mdipie...@cs.depaul.edu wrote: Fixed. 1.88.2 but please check it Woah! Two releases in a few hours! :D -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
Re: [web2py] Re: web2py 1.88.1 is OUT
I have a question: From Trunk it is going directly to Stable, or is passing throught Nighly Built for testing before going Stable? What is the roadmap/timeline for release cycle? 2010/10/29 Branko Vukelic bg.bra...@gmail.com On Sat, Oct 30, 2010 at 12:05 AM, mdipierro mdipie...@cs.depaul.edu wrote: Fixed. 1.88.2 but please check it Woah! Two releases in a few hours! :D -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- http://rochacbruno.com.br
[web2py] Re: web2py 1.88.1 is OUT
Normally it goes to the nightly build, perhaps not exactly the latest but something very close. The bug in question has been there for about one week. The problem is that nobody tests the nightly build. Massimo On Oct 29, 5:32 pm, Bruno Rocha rochacbr...@gmail.com wrote: I have a question: From Trunk it is going directly to Stable, or is passing throught Nighly Built for testing before going Stable? What is the roadmap/timeline for release cycle? 2010/10/29 Branko Vukelic bg.bra...@gmail.com On Sat, Oct 30, 2010 at 12:05 AM, mdipierro mdipie...@cs.depaul.edu wrote: Fixed. 1.88.2 but please check it Woah! Two releases in a few hours! :D -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- http://rochacbruno.com.br
[web2py] Re: Record Versioning findings
fixed in 1.88.2 On Oct 29, 4:45 pm, cjrh caleb.hatti...@gmail.com wrote: On Oct 29, 4:09 pm, baloan balo...@googlemail.com wrote: 3. In the documentation the archive table is defined like db.define_table('mytable_history', Field('current_record',db.mytable), db.mytable) while in the current version it is defined like db.define_table('mytable_arcvhive', Field('current_record',db.mytable), db.mytable) Just a typo correction needed in the documentation. The error is also in the comments section in gluon/tools.py itself, around line 2712. I have fixed the book, but the comment in the source code must still be fixed (by someone else).
[web2py] Re: Reference to the mapping table - No drop down in admin interface
format can be a function that takes the record returns a string. On Oct 29, 4:05 pm, Steve stephenga...@gmail.com wrote: Hi all, I am able to solve the issue. I just removed the following line. db.table_c.a_b_id.requires = IS_NOT_IN_DB(db, db.a_b) Now, I am getting the drop down. But the drop down shows the id of 'a_b' table. But ideally I would like the combination of a.name and b.name in the drop down for 'a_b_id' in the 'table_c'. By changing the format of 'a_b' as '%(a_id)s - %(b_id)s', I am able to show the ids combination. But I want to show the name combination to make the drop down more meaningful. Thanks, Steve. On Oct 29, 6:46 pm, Steve stephenga...@gmail.com wrote: Hi, I have the following table structure in my db.py. db.define_table('table_a', Field('x_id', db.table_x), Field('name', length=200, required=True), Field('description', length=300), Field('displayorder', 'integer', required=True), format='%(name)s') db.define_table('table_b', Field('name', length=45, required=True), Field('description', length=200), format='%(name)s') db.define_table('a_b', Field('a_id', db.table_a), Field('b_id', db.table_b), Field('displayorder', 'integer', required=True), format='%(id)s') db.define_table('user', Field('user_id', 'integer', required=True), Field('name', length=60, required=True), format='%(name)s') db.define_table('table_c', Field('a_b_id', db.a_b), Field('user_id', db.user), Field('content', 'text', required=True), Field('content', 'text', required=True)) db.table_c.a_b_id.requires = IS_NOT_IN_DB(db, db.a_b) Here, 'table_a' and 'table_b' have many to many mapping. Table 'a_b' is the mapping table. Now in 'table_c', I am referring to table 'a_b'. (the mapping table) While inserting into 'table_c', I am not getting the drop down for the 'a_b_id' column. But for the 'user_id' column, I am getting the drop down. I am not sure where things are going wrong. Any help is appreciated. Ideally I would like the combination of a.name and b.name in the drop down for 'a_b_id' in the 'table_c' By the way, web2py is an amazing piece of work. So far my experience has been great. Thanks, Steve.
[web2py] Re: Loading component with vars
Without ajax the component is loaded without the current request and therefore there are two request objects. I guess web2py got confused. It is a bug and I will fix it but I have not yet tested that is the case. Massimo On Oct 29, 1:56 pm, Luther Goh Lu Feng elf...@yahoo.com wrote: Thank you. I have set ajax = True and the line works now. What is the reason for this requirement? On Oct 30, 2:52 am, mdipierro mdipie...@cs.depaul.edu wrote: I am not sure this works unless you do it with ajax=True. I need to check. On Oct 29, 1:50 pm, Luther Goh Lu Feng elf...@yahoo.com wrote: In one of my views, I loaded a component using: {{=LOAD('comment', 'conversation_dropdown.load', vars={'dashboard':True}, ajax=False)}} In the action: def conversation_download(): return{'test':request.vars.dashboard} In conversation_dropdown.load, {{=test}} evaluates to none. Have I gotten the syntax wrong somewhere?
[web2py] Re: Some beginner questions on form
Tuples. Even better, I didn't realise that advantage regarding sorting. Also in the book, please? :) On Oct 29, 7:57 pm, mdipierro mdipie...@cs.depaul.edu wrote: It can also take a list of tuples. It will work like a dict of (key,value) but preserves sorting. On Oct 29, 11:32 am, villas villa...@gmail.com wrote: requires=IS_IN_SET({'key1':'label1','key2':'label2','key3':'label3'}) @David - thanks for reminding us of this. Book editors please note... The fact that IS_IN_SET can accept a dict should be in the Book? (Please forgive me if I missed it there!). -D
[web2py] Re: Some beginner questions on form
On 29 oct, 19:48, villas villa...@gmail.com wrote: Tuples. Even better, I didn't realise that advantage regarding sorting. Also in the book, please? :) Now yet in the book. A wonder that should be there!
[web2py] Re: Some beginner questions on form
On 29 oct, 19:48, villas villa...@gmail.com wrote: Tuples. Even better, I didn't realise that advantage regarding sorting. Also in the book, please? :) Now yet in the book. A wonder that should be there!
[web2py] web2py automatic installation on KingHost(Brazil) control panel.
Brazilian KingHost server now has web2py as an option for automatic installation on your control panel. According to information from the administrators of the host, many customers were starting to ask for the installation of web2py, and some later canceled the plan, citing difficulties in publishing their websites developed with web2py. Now web2py is included as an option in the automatic WSGI installer, together with Django, Pylons, TurboGears and web.py. http://www.kinghost.com.br/promo/WEB2PYKINGHOST.html --- Servidor de hospedagem brasileiro KingHost agora tem web2py como opção para instalação automática em seu painel de controle. De acordo com as informações dos administradores do host, muitos clientes estavam começando a pedir a instalação do web2py, e alguns acabaram cancelando o plano, alegando dificuldades para publicar seus sites desenvolvidos com web2py. Agora incluiram web2py como opção no instalador WSGI automático juntamente com o Django, Pylons, TurboGears e web.py. http://www.kinghost.com.br/promo/WEB2PYKINGHOST.html Código promocional WEB2PYKINGHOST 6 meses com 10% de desconto! ---
Re: [web2py] Re: web2py 1.88.1 is OUT
Can we make some sort of massive web2py app that makes use of every single feature in web2py (as much as possible). If the index page of the app returns OK then everything is working. ??? Kind of like a unit test without a unit test. -- Thadeus On Fri, Oct 29, 2010 at 6:05 PM, mdipierro mdipie...@cs.depaul.edu wrote: Normally it goes to the nightly build, perhaps not exactly the latest but something very close. The bug in question has been there for about one week. The problem is that nobody tests the nightly build. Massimo On Oct 29, 5:32 pm, Bruno Rocha rochacbr...@gmail.com wrote: I have a question: From Trunk it is going directly to Stable, or is passing throught Nighly Built for testing before going Stable? What is the roadmap/timeline for release cycle? 2010/10/29 Branko Vukelic bg.bra...@gmail.com On Sat, Oct 30, 2010 at 12:05 AM, mdipierro mdipie...@cs.depaul.edu wrote: Fixed. 1.88.2 but please check it Woah! Two releases in a few hours! :D -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- http://rochacbruno.com.br
[web2py] Re: PostgreSQL super slowdowns
I was just trying the home page...some selects are run on every page but as far as I know that's it. The machine's got plenty of memory and this is a very basic application with probably less than 1MB data total. On Oct 29, 7:59 am, Johann Spies johann.sp...@gmail.com wrote: On 29 October 2010 08:53, Chris partyonais...@gmail.com wrote: Hey, I've noticed some serious slowdowns ever since I switched from SQLite to Postgres. Pages will take MINUTES to load - it's kind of fascinating. I have been using both SQLITE and Postgresql (sometimes with the same content) and did not notice a slowdown. Some of my datasets are quite large (a dump of a present project's database is about 3G) and I don't experience any problem on Postgresql. What exactly were you doing when you noticed this? Inserts? Queries? CSV-downloads? How much data? How much ram available? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a