[web2py] Fetching a single field from multiple rows in gluon.sql.Rows as a tuple/list?
Hi, assuming that I have a Record table with a field called Name in the database (all also that there are a bunch of other fields for that table). Assume that I make the following query: Rows = db().select(db.Record.ALL) Is there a way to directly (with one line without having to iterate through each row and create the tuple/list manually) fetch the Name field for all the rows in a tuple/List? -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: best jquery plugin ever
Who still uses IE6 anyways? Ah, I once found a way to automatically close the web browser without asking for the user permission using javascript for IE7. I googled it somewhere. It was great for doing unit tests on the client-side GUI scripts. On Mar 31, 12:56 pm, mdipierro mdipie...@cs.depaul.edu wrote: http://plugins.jquery.com/project/crash -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Web2py mounted to sub-url
When I use the custom install script at WebFaction to install web2py the docs point me to the following caveat: Web2py won't work properly if it is mounted to a sub-URL like http://domain.com/web2py/. it must be mounted to the domain root. What exactly does this mean? Kind regards, Annet. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: use of the modules directory?
The 'modules' folder is for manually installing packages in the application. http://web2py.com/book/default/section/4/18 Jay On Apr 1, 1:45pm, Miguel goncalvesmig...@gmail.com wrote: Hi What is the purpose of the modules directory? I did not find an explanation in the web2py book. Also what is the web2py way of having a set of utility functions used by several controllers? Put everything in a file and import it? where should the file live? thanks Miguel -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: use of the modules directory?
The 'modules' folder is for manually installing packages in the application. http://web2py.com/book/default/section/4/18 Jay On Apr 1, 1:45 pm, Miguel goncalvesmig...@gmail.com wrote: Hi What is the purpose of the modules directory? I did not find an explanation in the web2py book. Also what is the web2py way of having a set of utility functions used by several controllers? Put everything in a file and import it? where should the file live? thanks Miguel -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: best jquery plugin ever
Who still uses IE6 anyways? Major corporations afraid of changing the software installed because it might break anything and cost millions to repair. My PC @work has ie6..it's as awesome as it sounds. Regards, Tiago -- On Thu, Apr 1, 2010 at 7:47 AM, Magnitus eric_vallee2...@yahoo.ca wrote: Who still uses IE6 anyways? Ah, I once found a way to automatically close the web browser without asking for the user permission using javascript for IE7. I googled it somewhere. It was great for doing unit tests on the client-side GUI scripts. On Mar 31, 12:56 pm, mdipierro mdipie...@cs.depaul.edu wrote: http://plugins.jquery.com/project/crash -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Fetching a single field from multiple rows in gluon.sql.Rows as a tuple/list?
thelist=[row.Name for row in db().select(db.Record.Name)] On Apr 1, 1:41 am, Magnitus eric_vallee2...@yahoo.ca wrote: Hi, assuming that I have a Record table with a field called Name in the database (all also that there are a bunch of other fields for that table). Assume that I make the following query: Rows = db().select(db.Record.ALL) Is there a way to directly (with one line without having to iterate through each row and create the tuple/list manually) fetch the Name field for all the rows in a tuple/List? -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: best jquery plugin ever
My PC @work has ie6..it's as awesome as it sounds. LOL! That made my day! Fortunately, I get to control my company so everyone gets a choice: IE8 or FF. I wish I could get them all on FF or Chrome, but people are creatures of habit. It's not worth the energy to push too hard. I haven't run into a situation yet that really kills me between IE7+ and the rest of the modern browser world. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: where is this coming from?
applications/admin/cron/crontab On Apr 1, 12:37 am, Jonathan Lundell jlund...@pobox.com wrote: Wed Mar 31 16:10:00 2010 hard CRON RUNNING ['/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python', 'web2py.py', '-P', '-N', '', '-S', 'admin', '-a', 'recycle', '-R', 'applications/admin/cron/expire_sessions.py'] -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Web2py mounted to sub-url
It is not true. It can be mounted in a sub-url but you the web server or web2py routes must be instructed to remove the web2py/ from the url. On Apr 1, 2:29 am, annet annet.verm...@gmail.com wrote: When I use the custom install script at WebFaction to install web2py the docs point me to the following caveat: Web2py won't work properly if it is mounted to a sub-URL likehttp://domain.com/web2py/. it must be mounted to the domain root. What exactly does this mean? Kind regards, Annet. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] web2py forked
Just kidding! Happy April Fools Day! -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: web2py forked
HAHAHAH you got me! :P On Apr 1, 8:39 am, mr.freeze nat...@freezable.com wrote: Just kidding! Happy April Fools Day! -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: Fetching a single field from multiple rows in gluon.sql.Rows as a tuple/list?
``db().select(db.Record.Name)`` returns a rows object, which acts like a tuple. -Thadeus On Thu, Apr 1, 2010 at 5:06 AM, DenesL denes1...@yahoo.ca wrote: thelist=[row.Name for row in db().select(db.Record.Name)] On Apr 1, 1:41 am, Magnitus eric_vallee2...@yahoo.ca wrote: Hi, assuming that I have a Record table with a field called Name in the database (all also that there are a bunch of other fields for that table). Assume that I make the following query: Rows = db().select(db.Record.ALL) Is there a way to directly (with one line without having to iterate through each row and create the tuple/list manually) fetch the Name field for all the rows in a tuple/List? -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: where is this coming from?
On Apr 1, 2010, at 6:18 AM, mdipierro wrote: applications/admin/cron/crontab The message itself, I mean. It's showing up on my console, and I can't find the source. On Apr 1, 12:37 am, Jonathan Lundell jlund...@pobox.com wrote: Wed Mar 31 16:10:00 2010 hard CRON RUNNING ['/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python', 'web2py.py', '-P', '-N', '', '-S', 'admin', '-a', 'recycle', '-R', 'applications/admin/cron/expire_sessions.py'] -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Proper handling of Undefined Record Exception in Reference Class
Somehow, I am getting the Undefined Record Exception being raised, from line 1429 in sql.py. When I comment out the exception, appadmin works just fine. It looks as if the reference is an ID that does not exist in my table. Somehow, the ID is 4057, when the highest ID in my table is only 4052, any ideas on how this could have happened, or how to even fix this!? -Thadeus -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Translate change password
I have an application in finnish and swedish and everything is translated into the fi.py and se.py files. Only thing that I can´t find how to translate is the Change password page. Ideas? Kenneth -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: web2py forked
LOL On Apr 1, 9:39 am, mr.freeze nat...@freezable.com wrote: Just kidding! Happy April Fools Day! -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: web2py forked
I prefer spoons. -Thadeus On Thu, Apr 1, 2010 at 9:44 AM, DenesL denes1...@yahoo.ca wrote: LOL On Apr 1, 9:39 am, mr.freeze nat...@freezable.com wrote: Just kidding! Happy April Fools Day! -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: where is this coming from?
my quick guess would be start at line 45, winservice.py -- it has ReportServiceStatus Actually - as I look at it, I'll bet it's coming from the call Service::log(), which calls which calls servicemanager.LogInfoMsg() Try setting a breakpoint there, and see if this stuff shows up in the msg param or log() Cheers, - Yarko On Apr 1, 9:39 am, Jonathan Lundell jlund...@pobox.com wrote: On Apr 1, 2010, at 6:18 AM, mdipierro wrote: applications/admin/cron/crontab The message itself, I mean. It's showing up on my console, and I can't find the source. On Apr 1, 12:37 am, Jonathan Lundell jlund...@pobox.com wrote: Wed Mar 31 16:10:00 2010 hard CRON RUNNING ['/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python', 'web2py.py', '-P', '-N', '', '-S', 'admin', '-a', 'recycle', '-R', 'applications/admin/cron/expire_sessions.py'] -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: response.headers web2py-component-command is being cut short
According to http://api.jquery.com/jQuery.ajax/ dataType, one of the settings of jQuery.ajax, when set to html returns HTML as plain text; included script tags are evaluated when inserted in the DOM. Similar effect is obtained setting it to script but with the side effect of turning POSTs into GETs. On Mar 28, 8:28 am, DenesL denes1...@yahoo.ca wrote: This makes an interesting readhttp://ajaxpatterns.org/On-Demand_Javascript -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: Proper handling of Undefined Record Exception in Reference Class
Yes but out of 4050 records, how do I determine the one record that got borked, since obviously record 4057 does not exist. I have queried reference fields and nothing refers to a record 4057 either. p.s. this was with using sqlite browser -Thadeus On Thu, Apr 1, 2010 at 9:53 AM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 9:52 am, Thadeus Burgess thade...@thadeusb.com wrote: Somehow, I am getting the Undefined Record Exception being raised, from line 1429 in sql.py. When I comment out the exception, appadmin works just fine. It looks as if the reference is an ID that does not exist in my table. ... implied: NOT a clean install Somehow, the ID is 4057, when the highest ID in my table is only 4052, any ideas on how this could have happened, or how to even fix this!? Guess: has to do with your table references for action in [debuggin, info]: provide action ;-) - Yarko -Thadeus -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Translate change password
Looking at gluon/tools.py (around line 600:) I see all the messages, labels, and strings that can be customized. For a start, you could copy this entire list into your db.py (or wherever you enable auth), and at a minimum reset each such as this: auth.messages.submit_button = T('Submit') I seem to remember something about this not being done in gluon because T() is not necessarily known there... Hope that helps. - Yarko On Apr 1, 10:08 am, GhostRider kenneth.t.lundst...@gmail.com wrote: I have an application in finnish and swedish and everything is translated into the fi.py and se.py files. Only thing that I can´t find how to translate is the Change password page. Ideas? Kenneth -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] editarea plugin lacks OS X Intel support
...or so I gather from my console log: 3/31/10 10:42:41 PM mdworker[18101] (Warning) Import: /.../web2py/applications/admin/static/edit_area/edit_area_full_with_plugins.gz could not be imported; Only a PPC importer plug-in was found. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Proper handling of Undefined Record Exception in Reference Class
I'd first (quickly) try: save table (or tables) as csv, then grep 4057 to see where it shows up, and work from there. - Yarko On Apr 1, 10:56 am, Thadeus Burgess thade...@thadeusb.com wrote: Yes but out of 4050 records, how do I determine the one record that got borked, since obviously record 4057 does not exist. I have queried reference fields and nothing refers to a record 4057 either. p.s. this was with using sqlite browser -Thadeus On Thu, Apr 1, 2010 at 9:53 AM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 9:52 am, Thadeus Burgess thade...@thadeusb.com wrote: Somehow, I am getting the Undefined Record Exception being raised, from line 1429 in sql.py. When I comment out the exception, appadmin works just fine. It looks as if the reference is an ID that does not exist in my table. ... implied: NOT a clean install Somehow, the ID is 4057, when the highest ID in my table is only 4052, any ideas on how this could have happened, or how to even fix this!? Guess: has to do with your table references for action in [debuggin, info]: provide action ;-) - Yarko -Thadeus -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: where is this coming from?
On Apr 1, 2010, at 8:49 AM, Yarko Tymciurak wrote: my quick guess would be start at line 45, winservice.py -- it has ReportServiceStatus This is OS X, so not winservice. Presumably. I was running 1.76.3 inadvertently; I'll see what happens with .5. Actually - as I look at it, I'll bet it's coming from the call Service::log(), which calls which calls servicemanager.LogInfoMsg() Try setting a breakpoint there, and see if this stuff shows up in the msg param or log() Cheers, - Yarko On Apr 1, 9:39 am, Jonathan Lundell jlund...@pobox.com wrote: On Apr 1, 2010, at 6:18 AM, mdipierro wrote: applications/admin/cron/crontab The message itself, I mean. It's showing up on my console, and I can't find the source. On Apr 1, 12:37 am, Jonathan Lundell jlund...@pobox.com wrote: Wed Mar 31 16:10:00 2010 hard CRON RUNNING ['/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python', 'web2py.py', '-P', '-N', '', '-S', 'admin', '-a', 'recycle', '-R', 'applications/admin/cron/expire_sessions.py'] -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] web2py book and softcron
Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't say how to override them. Section 4.1 (cli) doesn't list --softcron The startup message for soft cron says: 'Using softcron (but this is not very efficient)' In what sense not efficient? I understand that the timing is less consistent, but is there really more overhead? softcron seems like a pretty reasonable choice if all you're doing it deleting expired sessions. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: web2py book and softcron
There is some overhead, but efficiency is a disputable term - there is certainly more overhead than hardcron, but IMO not in a way that would affect overall performance unless you're running it on a site that has hundreds of thousands of hits per day... On Apr 1, 5:40 pm, Jonathan Lundell jlund...@pobox.com wrote: Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't say how to override them. Section 4.1 (cli) doesn't list --softcron The startup message for soft cron says: 'Using softcron (but this is not very efficient)' In what sense not efficient? I understand that the timing is less consistent, but is there really more overhead? softcron seems like a pretty reasonable choice if all you're doing it deleting expired sessions. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: web2py book and softcron
On Apr 1, 2010, at 10:37 AM, AchipA wrote: There is some overhead, but efficiency is a disputable term - there is certainly more overhead than hardcron, but IMO not in a way that would affect overall performance unless you're running it on a site that has hundreds of thousands of hits per day... Perhaps we could change (or eliminate) the wording. How about simply 'Using softcron'? I'm curious: what is the extra overhead of soft vs hard cron? Just that it does a test on each page access? I'm guessing that's pretty cheap. On Apr 1, 5:40 pm, Jonathan Lundell jlund...@pobox.com wrote: Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't say how to override them. Section 4.1 (cli) doesn't list --softcron The startup message for soft cron says: 'Using softcron (but this is not very efficient)' In what sense not efficient? I understand that the timing is less consistent, but is there really more overhead? softcron seems like a pretty reasonable choice if all you're doing it deleting expired sessions. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Fetching a single field from multiple rows in gluon.sql.Rows as a tuple/list?
Thanks for both replies :). So, if ``db().select(db.Record.Name)`` acts like a tuple, then I can do something like this: Names_in_db = db().select(db.Record.Name) for Name in List_of_names: if Name in Names_in_db: #Update logic goes here else: #Insert logic goes here Also, I have another question: The belongs member function for DAL.Table.Field allows you to isolate rows for which a particular field is in a given set of values. Is there a short direct way to specify that you actually want to isolate the rows for which a particular field is in the complement of the set? Likes (for example... actually, its pretty much what I'm trying to do in my code): db(db.Record.Group_id==ID (! db.Record.Name.belongs(List_of_names))).delete() Note: The above syntax is not correct and gives an error, but it illustrates what I'm trying to achieve. On Apr 1, 10:30 am, Thadeus Burgess thade...@thadeusb.com wrote: ``db().select(db.Record.Name)`` returns a rows object, which acts like a tuple. -Thadeus On Thu, Apr 1, 2010 at 5:06 AM, DenesL denes1...@yahoo.ca wrote: thelist=[row.Name for row in db().select(db.Record.Name)] On Apr 1, 1:41 am, Magnitus eric_vallee2...@yahoo.ca wrote: Hi, assuming that I have a Record table with a field called Name in the database (all also that there are a bunch of other fields for that table). Assume that I make the following query: Rows = db().select(db.Record.ALL) Is there a way to directly (with one line without having to iterate through each row and create the tuple/list manually) fetch the Name field for all the rows in a tuple/List? -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: web2py book and softcron
Exactly, hardcron checks once a minute, softcron checks on each page load. The 'check' is calling a function or two and comparing a file's timestamp, so not *that* much more expensive. On Apr 1, 7:51 pm, Jonathan Lundell jlund...@pobox.com wrote: On Apr 1, 2010, at 10:37 AM, AchipA wrote: There is some overhead, but efficiency is a disputable term - there is certainly more overhead than hardcron, but IMO not in a way that would affect overall performance unless you're running it on a site that has hundreds of thousands of hits per day... Perhaps we could change (or eliminate) the wording. How about simply 'Using softcron'? I'm curious: what is the extra overhead of soft vs hard cron? Just that it does a test on each page access? I'm guessing that's pretty cheap. On Apr 1, 5:40 pm, Jonathan Lundell jlund...@pobox.com wrote: Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't say how to override them. Section 4.1 (cli) doesn't list --softcron The startup message for soft cron says: 'Using softcron (but this is not very efficient)' In what sense not efficient? I understand that the timing is less consistent, but is there really more overhead? softcron seems like a pretty reasonable choice if all you're doing it deleting expired sessions. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Fetching a single field from multiple rows in gluon.sql.Rows as a tuple/list?
Ah, I found the answer to my question in the post: http://groups.google.com/group/web2py/browse_thread/thread/cf8ad3e94fc9f1da/59261d38a98ece4d?lnk=gstq=belongs#59261d38a98ece4d So, I guess I'll modify: db(db.Record.Group_id==ID (! db.Record.Name.belongs(List_of_names))).delete() To be: db('NOT %s' % (db.Record.Group_id!=ID | db.Record.Name.belongs(List_of_names))).delete() Got it. On Apr 1, 2:01 pm, Magnitus eric_vallee2...@yahoo.ca wrote: Thanks for both replies :). So, if ``db().select(db.Record.Name)`` acts like a tuple, then I can do something like this: Names_in_db = db().select(db.Record.Name) for Name in List_of_names: if Name in Names_in_db: #Update logic goes here else: #Insert logic goes here Also, I have another question: The belongs member function for DAL.Table.Field allows you to isolate rows for which a particular field is in a given set of values. Is there a short direct way to specify that you actually want to isolate the rows for which a particular field is in the complement of the set? Likes (for example... actually, its pretty much what I'm trying to do in my code): db(db.Record.Group_id==ID (! db.Record.Name.belongs(List_of_names))).delete() Note: The above syntax is not correct and gives an error, but it illustrates what I'm trying to achieve. On Apr 1, 10:30 am, Thadeus Burgess thade...@thadeusb.com wrote: ``db().select(db.Record.Name)`` returns a rows object, which acts like a tuple. -Thadeus On Thu, Apr 1, 2010 at 5:06 AM, DenesL denes1...@yahoo.ca wrote: thelist=[row.Name for row in db().select(db.Record.Name)] On Apr 1, 1:41 am, Magnitus eric_vallee2...@yahoo.ca wrote: Hi, assuming that I have a Record table with a field called Name in the database (all also that there are a bunch of other fields for that table). Assume that I make the following query: Rows = db().select(db.Record.ALL) Is there a way to directly (with one line without having to iterate through each row and create the tuple/list manually) fetch the Name field for all the rows in a tuple/List? -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: Fetching a single field from multiple rows in gluon.sql.Rows as a tuple/list?
This will embed a sub query and use belongs on it. db((db.Record.Group_id == ID) (db.Record.Name.belongs(db(db.Record.BloodType == 'O-')._select(.count() Alternatively for NOT db((db.Record.Group_id == ID) (~db.Record.Name.belongs(db(db.Record.BloodType == 'O-')._select(.count() -Thadeus On Thu, Apr 1, 2010 at 12:01 PM, Magnitus eric_vallee2...@yahoo.ca wrote: Thanks for both replies :). So, if ``db().select(db.Record.Name)`` acts like a tuple, then I can do something like this: Names_in_db = db().select(db.Record.Name) for Name in List_of_names: if Name in Names_in_db: #Update logic goes here else: #Insert logic goes here Also, I have another question: The belongs member function for DAL.Table.Field allows you to isolate rows for which a particular field is in a given set of values. Is there a short direct way to specify that you actually want to isolate the rows for which a particular field is in the complement of the set? Likes (for example... actually, its pretty much what I'm trying to do in my code): db(db.Record.Group_id==ID (! db.Record.Name.belongs(List_of_names))).delete() Note: The above syntax is not correct and gives an error, but it illustrates what I'm trying to achieve. On Apr 1, 10:30 am, Thadeus Burgess thade...@thadeusb.com wrote: ``db().select(db.Record.Name)`` returns a rows object, which acts like a tuple. -Thadeus On Thu, Apr 1, 2010 at 5:06 AM, DenesL denes1...@yahoo.ca wrote: thelist=[row.Name for row in db().select(db.Record.Name)] On Apr 1, 1:41 am, Magnitus eric_vallee2...@yahoo.ca wrote: Hi, assuming that I have a Record table with a field called Name in the database (all also that there are a bunch of other fields for that table). Assume that I make the following query: Rows = db().select(db.Record.ALL) Is there a way to directly (with one line without having to iterate through each row and create the tuple/list manually) fetch the Name field for all the rows in a tuple/List? -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Proper handling of Undefined Record Exception in Reference Class
On Apr 1, 11:17 am, Thadeus Burgess thade...@thadeusb.com wrote: Got it. Thanks. So lets repeat some steps to see how this happened. Production Database - Open appadmin: Everything OK. - print db(db.category.id 0).select(orderby=~db.category.id).first() category.id - 4059 # this is the highest category in databases category.name - sports - db.export_to_csv_file(open('/tmp/dumps.csv', 'w')) mv /tmp/dumps.csv - local://home/dumps.csv Local Environment - Delete everything under databases. - Refresh appadmin - db.import_from_csv_file(open('/home/dumps.csv', 'r')) export / import use csv.reader / csv.writer --- DAL import_from_csv_file calls Table import_from_csv_file --- you should look at how these setup, and if that's causing the problem. The table ID's triy to be re-numbered - it might be that a reference is being missed (if you have a reference field defined as an integer, I would suspec that - otherwise, might be a bug in the way the import happens). Basically - look at the csv file manually, and then try to find the reference that is potentially causing you the problem - figure it out, and fix it (I know that's not helpful in itself, but that's the level you need to look at, at this point). - Yarko - Refresh appadmin - Raises - Undefined Exception - get record id. - bad_reference = db(db.category.parent == bad_record_id).select() - len(bad_reference) = 1 - print bad_reference.parent == 4057 - print db(db.category.id 0).select(orderby=~db.category.id).first() category.id - 4053 # this is the highest category in databases category.name - sports Am I missing something here or doing something wrong? -Thadeus On Thu, Apr 1, 2010 at 10:05 AM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: I'd first (quickly) try: save table (or tables) as csv, then grep 4057 to see where it shows up, and work from there. - Yarko On Apr 1, 10:56 am, Thadeus Burgess thade...@thadeusb.com wrote: Yes but out of 4050 records, how do I determine the one record that got borked, since obviously record 4057 does not exist. I have queried reference fields and nothing refers to a record 4057 either. p.s. this was with using sqlite browser -Thadeus On Thu, Apr 1, 2010 at 9:53 AM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 9:52 am, Thadeus Burgess thade...@thadeusb.com wrote: Somehow, I am getting the Undefined Record Exception being raised, from line 1429 in sql.py. When I comment out the exception, appadmin works just fine. It looks as if the reference is an ID that does not exist in my table. ... implied: NOT a clean install Somehow, the ID is 4057, when the highest ID in my table is only 4052, any ideas on how this could have happened, or how to even fix this!? Guess: has to do with your table references for action in [debuggin, info]: provide action ;-) - Yarko -Thadeus -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] crud update with represent
Hi, As I understand, when crud.update(...) creates a form it pulls the values of a given record into the form as a string. If the field is a reference to another table, then this shows up as a number. I would like to instead show the name of the record instead of the id. I have a represent function set in the data model, but that is only used on crud.select(). So, my question is how can I get the crud.update(...) form to render the record values with according to the represent function specified by the represent function of the field. Code below: #model db.define_table(food, Field(desc, string,) ) db.define_table(ate, Field(food_id, db.food, represent=lambda x: db(db.food.id==x).select().first().desc ) ) #controller form=crud.update(db.ate,ate_id) Thanks, Avik -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] psycopg2 problem
I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
Massimo can explain to you how this happens, but this is not a problem - it's a feature: From your web2py directory, if you do: python web2py.py -S welcome -M to get a web2py application context shell, with your models imported, you also get: In [1]: psycopg2 --- NameError Traceback (most recent call last) .../web2py-dev/ipython console in module() NameError: name 'psycopg2' is not defined Since, if you were messing with psycopg2, you would be competing with DAL, it's a good thing to discourage you from doing so. If you _really_ want to, your model can also do import psycopg2 and this will solve your problem - but I do not recommend doing this. If your concern is can I connect to a postgres db? --- then to a try/except around db= DAL(DBURI), where DBURI is an appropriate connection string. Regards, - Yarko On Apr 1, 2:48 pm, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
On Apr 1, 3:07 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: Massimo can explain to you how this happens, but this is not a problem - it's a feature: ... that is, gluon/dal.py trys to import psycopg2 as it builds up a list of available drivers; you just can't see psycopg2, and that's a good thing. If you want to deal w/ psycopg2 directly, don't use DAL - do your own talking to the DB, you can... but one _or_ the other. - y From your web2py directory, if you do: python web2py.py -S welcome -M to get a web2py application context shell, with your models imported, you also get: In [1]: psycopg2 --- NameError Traceback (most recent call last) .../web2py-dev/ipython console in module() NameError: name 'psycopg2' is not defined Since, if you were messing with psycopg2, you would be competing with DAL, it's a good thing to discourage you from doing so. If you _really_ want to, your model can also do import psycopg2 and this will solve your problem - but I do not recommend doing this. If your concern is can I connect to a postgres db? --- then to a try/except around db= DAL(DBURI), where DBURI is an appropriate connection string. Regards, - Yarko On Apr 1, 2:48 pm, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] psycopg2 problem
Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: psycopg2 problem
We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Using Ajax to display detail from a list
What I want to do: have a list of items displayed; when one is clicked, more detail is shown (via an Ajax call) in a defined detail area. Problem: the web2py ajax call takes three parameters: a controller action, one or more field ids, and a target DIV. My controller action needs to identify which row has been clicked on, so I need a hidden field per row that holds the row number. Because all field ids need to be unique, I actually have to build a dynamic name for the row id (eg, id=row_{{=row.number}}, name=row_{{=row.number}}), and - even worse - my controller action doesn't know the name of the field passed, so it has to parse response.vars to find it. Web2py and Python in general are so well architected that I know there must be a better way. Could someone point it out, please? Thanks. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: new SQLFORM
So why formstyle instead of form.as_div() or form.as_ul() ?? -Thadeus On Wed, Mar 24, 2010 at 8:18 PM, mdipierro mdipie...@cs.depaul.edu wrote: Thank you! On Mar 24, 8:21 pm, Jose jjac...@gmail.com wrote: I sent a patch to Massimo -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
Thanks for the quick responses, people, it's my first time using this group and I'm impressed already! My question is definately HOW can I connect to a postgres db? My current conn string is db=SQLDB('postgres://postg...@127.0.0.1:5432/ database'). Do I just need to change the SQLDB to a DAL? Will this stop web2py calling sql.py? Rich On Apr 1, 9:16 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
python web2py.py -S welcome gives Database drivers available: SQLite3, PostgreSQL and import psycopg2 is successful. Tried using DAL and just got the same error : NameError: global name 'psycopg2' is not defined I feel like such a noob :( On Apr 1, 9:16 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
@Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: psycopg2 problem
So mod_wsgi will not let you print, try this (before your db=DAL(...) statement) import sys tmp_file = open('/path/to/a/writable/file.txt', 'w') tmp_file.write(sys.version) tmp_file.close() db = DAL(...) Try and access default controller (you will get an error, but now we have a file) Open up the file, and make sure the version corresponds to the one your shell is using. Probably not the most elegant way, but its quick. -Thadeus On Thu, Apr 1, 2010 at 2:39 PM, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
Worked fine.. 2.5.2 (r252:60911, Jan 20 2010, 23:30:56) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] Same version! Extra confused now... On Apr 1, 9:42 pm, Thadeus Burgess thade...@thadeusb.com wrote: So mod_wsgi will not let you print, try this (before your db=DAL(...) statement) import sys tmp_file = open('/path/to/a/writable/file.txt', 'w') tmp_file.write(sys.version) tmp_file.close() db = DAL(...) Try and access default controller (you will get an error, but now we have a file) Open up the file, and make sure the version corresponds to the one your shell is using. Probably not the most elegant way, but its quick. -Thadeus On Thu, Apr 1, 2010 at 2:39 PM, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Using Ajax to display detail from a list
I usually do something similar. Even to the extreme of my td have an extra column. So My id usually looks like id=tablename_recordid_column And in my controllers I parse this as tablename, record_id, column = request.vars.id.split('_') -Thadeus On Thu, Apr 1, 2010 at 2:24 PM, Keith Edmunds k...@midnighthax.com wrote: What I want to do: have a list of items displayed; when one is clicked, more detail is shown (via an Ajax call) in a defined detail area. Problem: the web2py ajax call takes three parameters: a controller action, one or more field ids, and a target DIV. My controller action needs to identify which row has been clicked on, so I need a hidden field per row that holds the row number. Because all field ids need to be unique, I actually have to build a dynamic name for the row id (eg, id=row_{{=row.number}}, name=row_{{=row.number}}), and - even worse - my controller action doesn't know the name of the field passed, so it has to parse response.vars to find it. Web2py and Python in general are so well architected that I know there must be a better way. Could someone point it out, please? Thanks. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: psycopg2 problem
And to triple make sure... from the shell printing sys.version gives exactly the same, date, revision, GCC version ? mod_wsgi was compiled with the same version of python installed? So just to make sure you only get the GlobalName when you access web2py through mod_wsgi ? tburg...@***-dev:~/Applications/web2py$ python web2py.py -S welcome db = DAL('postgres://user:p...@localhost:1234/database') Correct? and tburg...@***-dev:~/Applications/web2py$ python import psycopg2 -Thadeus On Thu, Apr 1, 2010 at 2:46 PM, Richie richie.d...@googlemail.com wrote: Worked fine.. 2.5.2 (r252:60911, Jan 20 2010, 23:30:56) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] Same version! Extra confused now... On Apr 1, 9:42 pm, Thadeus Burgess thade...@thadeusb.com wrote: So mod_wsgi will not let you print, try this (before your db=DAL(...) statement) import sys tmp_file = open('/path/to/a/writable/file.txt', 'w') tmp_file.write(sys.version) tmp_file.close() db = DAL(...) Try and access default controller (you will get an error, but now we have a file) Open up the file, and make sure the version corresponds to the one your shell is using. Probably not the most elegant way, but its quick. -Thadeus On Thu, Apr 1, 2010 at 2:39 PM, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: web2py forked
LOL. I jumped on my seat for a second! On Apr 1, 10:46 am, Thadeus Burgess thade...@thadeusb.com wrote: I prefer spoons. -Thadeus On Thu, Apr 1, 2010 at 9:44 AM, DenesL denes1...@yahoo.ca wrote: LOL On Apr 1, 9:39 am, mr.freeze nat...@freezable.com wrote: Just kidding! Happy April Fools Day! -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
yup... statement 1; april fool's on me (I didn't read the original post accurately enough; Thadeus was right)... Not sure you have found anything interesting yet, though... Tell us more about your environment - ... also, may be time to look at the apache logs; restart the wsgi thread; On Apr 1, 3:39 pm, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: response.headers web2py-component-command is being cut short
This means that any script included in the returned ajax call data will be evaluated (run) after the target element is updated but the script itself will not be part of the target. If the returned data is guessed by jQuery as not being 'html' this does not happen. Massimo, can this explain what you have experienced?. Also note that the 'success' function runs before the 'complete' function in web2py_ajax_page, I am not sure if you have those two reversed. Denes. On Apr 1, 11:55 am, DenesL denes1...@yahoo.ca wrote: According tohttp://api.jquery.com/jQuery.ajax/ dataType, one of the settings of jQuery.ajax, when set to html returns HTML as plain text; included script tags are evaluated when inserted in the DOM. Similar effect is obtained setting it to script but with the side effect of turning POSTs into GETs. On Mar 28, 8:28 am, DenesL denes1...@yahoo.ca wrote: This makes an interesting readhttp://ajaxpatterns.org/On-Demand_Javascript -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
Console sys.version gives 2.5.2 (r252:60911, Jan 20 2010, 23:14:04) \n[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3) : identical! What do you need to know about environment? It's a VPS running Ubuntu 8.04.1 64 bit Minimal, I tried easy_install psycopg2 but had issues, then did apt-get python-psycopg2. Got Apache connecting with WSGI, life is good... I feel like a fool asking this but... how do I restart the wsgi thread? I've been /etc/init.d/apache2 restart, but I'm guessing that doesn't touch the wsgi thread, right? Rich On Apr 1, 9:59 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: yup... statement 1; april fool's on me (I didn't read the original post accurately enough; Thadeus was right)... Not sure you have found anything interesting yet, though... Tell us more about your environment - ... also, may be time to look at the apache logs; restart the wsgi thread; On Apr 1, 3:39 pm, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
On Apr 1, 4:12 pm, Richie richie.d...@googlemail.com wrote: Console sys.version gives 2.5.2 (r252:60911, Jan 20 2010, 23:14:04) \n[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3) : identical! What do you need to know about environment? It's a VPS running Ubuntu 8.04.1 64 bit Minimal, I tried easy_install psycopg2 but had issues, then did apt-get python-psycopg2. Got Apache connecting with WSGI, life is good... I feel like a fool asking this but... how do I restart the wsgi thread? I've been /etc/init.d/apache2 restart, but I'm guessing that doesn't touch the wsgi thread, right? that's good enough; if you were serving multiple sites w/ apache, then you could have your wsgi thread just restart; but don't worry about that now - this is a superset of that, and good enough in your environment. Rich On Apr 1, 9:59 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: yup... statement 1; april fool's on me (I didn't read the original post accurately enough; Thadeus was right)... Not sure you have found anything interesting yet, though... Tell us more about your environment - ... also, may be time to look at the apache logs; restart the wsgi thread; On Apr 1, 3:39 pm, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
From command line python db = DAL('postgres://posttg...@localhost: 5432/appdb') gives a FATAL: no pg_hba.conf entry for host 127.0.0.1, user postgres, database appdb, SSL off but this is a different issue that I can sort out later! It is still accessing that postgres server to get that error, which web2py isn't. import psycopg2 works perfectly. Seems like web2py's dal.py module cannot find psycop2 even though command line python can, but I have no idea why. Path probs? I'm clueless! On Apr 1, 9:55 pm, Thadeus Burgess thade...@thadeusb.com wrote: And to triple make sure... from the shell printing sys.version gives exactly the same, date, revision, GCC version ? mod_wsgi was compiled with the same version of python installed? So just to make sure you only get the GlobalName when you access web2py through mod_wsgi ? tburg...@***-dev:~/Applications/web2py$ python web2py.py -S welcome db = DAL('postgres://user:p...@localhost:1234/database') Correct? and tburg...@***-dev:~/Applications/web2py$ python import psycopg2 -Thadeus On Thu, Apr 1, 2010 at 2:46 PM, Richie richie.d...@googlemail.com wrote: Worked fine.. 2.5.2 (r252:60911, Jan 20 2010, 23:30:56) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] Same version! Extra confused now... On Apr 1, 9:42 pm, Thadeus Burgess thade...@thadeusb.com wrote: So mod_wsgi will not let you print, try this (before your db=DAL(...) statement) import sys tmp_file = open('/path/to/a/writable/file.txt', 'w') tmp_file.write(sys.version) tmp_file.close() db = DAL(...) Try and access default controller (you will get an error, but now we have a file) Open up the file, and make sure the version corresponds to the one your shell is using. Probably not the most elegant way, but its quick. -Thadeus On Thu, Apr 1, 2010 at 2:39 PM, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more
[web2py] Re: Validation per object
sorry for this out of sync answer but though I managed some tricks to tackle the (problem of) validation in pure html forms during these years, I would be curious about an answer to Mengu's request of showing how to make validation with manual forms. Sorry DenesL but you did not answer the question as you supposed a model in place, so I would really appreciate a simple html form which preserves validation. Thank you carlo On 15 Mar, 21:09, DenesL denes1...@yahoo.ca wrote: On Mar 15, 6:28 am, Mengu whalb...@gmail.com wrote: First of all, I am not sure what is the problem you are trying to solve. Even if you havecustomformsand you build all the form html manually you can still use the existing validation mechanism. I don't want to use crud or sqlform or any html helper. i build my formsmanually. and actually if you show me how to make validation with manualforms, it would be good. You could set the error messages in the requires db.users.name.requires = IS_NOT_EMPTY(error_message = Please enter your name) db.users.email.requires = [ IS_EMAIL(error_message=Given e-mail is not a valid one.), IS_NOT_IN_DB(db,'users.email',error_message=Sorry, this e-mail already exists in our database) ] create your form with the same field names and to check them do for n,v in request.vars.items(): rr=db.users[n].requires if isinstance(rr,list): t,e=v,None for r in rr: t,e=r(t) if e: break else: t,e=rr(v) if e: form.errors[n]=e # here do whatever you need to do with form.errors Denes -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: web2py book and softcron
On Apr 1, 2010, at 11:20 AM, AchipA wrote: Exactly, hardcron checks once a minute, softcron checks on each page load. The 'check' is calling a function or two and comparing a file's timestamp, so not *that* much more expensive. Thanks. In that case, I have a suggestion, perhaps not entirely thought out. If cron is being used only for something relatively simple, say expire_sessions.py, how about a kind of 'cron lite' that runs its tasks in the context of an application rather than spawning an entirely new instance of python+web2py to do the work? At the point where softcron is invoked, at the end of a request, if we're running in litecron mode, process only the crontab file for the current app, and run the cron tasks more or less as if they were models (that is, exec in environment). On Apr 1, 7:51 pm, Jonathan Lundell jlund...@pobox.com wrote: On Apr 1, 2010, at 10:37 AM, AchipA wrote: There is some overhead, but efficiency is a disputable term - there is certainly more overhead than hardcron, but IMO not in a way that would affect overall performance unless you're running it on a site that has hundreds of thousands of hits per day... Perhaps we could change (or eliminate) the wording. How about simply 'Using softcron'? I'm curious: what is the extra overhead of soft vs hard cron? Just that it does a test on each page access? I'm guessing that's pretty cheap. On Apr 1, 5:40 pm, Jonathan Lundell jlund...@pobox.com wrote: Section 4.17 (cron) mentions hard vs soft cron defaults, but doesn't say how to override them. Section 4.1 (cli) doesn't list --softcron The startup message for soft cron says: 'Using softcron (but this is not very efficient)' In what sense not efficient? I understand that the timing is less consistent, but is there really more overhead? softcron seems like a pretty reasonable choice if all you're doing it deleting expired sessions. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
On Apr 2, 7:42 am, Thadeus Burgess thade...@thadeusb.com wrote: Somod_wsgi will not let you print, Not true. For older versions of mod_wsgi if you use 'print' you need to redirect it to 'sys.stderr' is all. This is because using sys.stdin/sys.stderr in a WSGI application is not portable. Because though people are lazy and wouldn't fix their code and instead just want to blame mod_wsgi and say it is broken, more recent mod_wsgi versions don't try and make people write portable code any more and allow them to hang themselves by using 'print' to sys.stdout. A post from a year ago about this can be found at: http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output.html So, use mod_wsgi 3.X and there is no restriction. Graham try this (before your db=DAL(...) statement) import sys tmp_file = open('/path/to/a/writable/file.txt', 'w') tmp_file.write(sys.version) tmp_file.close() db = DAL(...) Try and access default controller (you will get an error, but now we have a file) Open up the file, and make sure the version corresponds to the one your shell is using. Probably not the most elegant way, but its quick. -Thadeus On Thu, Apr 1, 2010 at 2:39 PM, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the versionmod_wsgiis using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make suremod_wsgiis running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] New Python IDE for Windows/Mac/Linux
Pycharm: http://www.jetbrains.com/pycharm/index.html -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: DAL Oracle Query problems
Thanks!! It is noted... Jay On Mar 30, 10:18 pm, DenesL denes1...@yahoo.ca wrote: On Mar 30, 4:09 am, Jason Lotz jayl...@gmail.com wrote: I'm sorry if I am repeating an existing discussion. I searched and found similar issues but nothing that helped. I am trying to query an oracle db. raw sql: SELECT fld1, fld2 FROM tbl1 WHERE fld1 20; I can successfully run the query in SQLPlus and using cx_Oracle directly in web2py. import cx_Oracle orcl = cx_Oracle.connect('user/passw...@tns') curs = orcl.cursor() curs.execute(sql) print curs.fetchall() When I try to run the query with DAL I get an KeyError: db=('DAL://user/p...@tns') print db(db.tbl1.fld120).select(fld1,fld2) Traceback (most recent call last): File console, line 1, in module File C:\web2py\gluon\sql.py, line 1295, in __getattr__ return dict.__getitem(self,key) KeyError: 'tbl1' Probably a really silly question but do I need to db.define_table for an existing table? Is the table name case sensitive? Yes, you have to define_table before web2py can use it. When accessing an existing table, i.e., a table not created by web2py in the current application, always set migrate=False. I don't know if table names are case sensitive in Oracle. Denes -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: psycopg2 problem
On Apr 1, 4:40 pm, Richie richie.d...@googlemail.com wrote: From command line python db = DAL('postgres://posttg...@localhost: 5432/appdb') gives a FATAL: no pg_hba.conf entry for host 127.0.0.1, user postgres, database appdb, SSL off but this is a different issue that I can sort out later! It is still accessing that postgres server to get that error, which web2py isn't. A really basic check: have you created the database, appdb, and given it no-password rights to user posttgres (? is that use spelled correctly???) for at least read and modify? - Yarko import psycopg2 works perfectly. Seems like web2py's dal.py module cannot find psycop2 even though command line python can, but I have no idea why. Path probs? I'm clueless! On Apr 1, 9:55 pm, Thadeus Burgess thade...@thadeusb.com wrote: And to triple make sure... from the shell printing sys.version gives exactly the same, date, revision, GCC version ? mod_wsgi was compiled with the same version of python installed? So just to make sure you only get the GlobalName when you access web2py through mod_wsgi ? tburg...@***-dev:~/Applications/web2py$ python web2py.py -S welcome db = DAL('postgres://user:p...@localhost:1234/database') Correct? and tburg...@***-dev:~/Applications/web2py$ python import psycopg2 -Thadeus On Thu, Apr 1, 2010 at 2:46 PM, Richie richie.d...@googlemail.com wrote: Worked fine.. 2.5.2 (r252:60911, Jan 20 2010, 23:30:56) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] Same version! Extra confused now... On Apr 1, 9:42 pm, Thadeus Burgess thade...@thadeusb.com wrote: So mod_wsgi will not let you print, try this (before your db=DAL(...) statement) import sys tmp_file = open('/path/to/a/writable/file.txt', 'w') tmp_file.write(sys.version) tmp_file.close() db = DAL(...) Try and access default controller (you will get an error, but now we have a file) Open up the file, and make sure the version corresponds to the one your shell is using. Probably not the most elegant way, but its quick. -Thadeus On Thu, Apr 1, 2010 at 2:39 PM, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to
[web2py] Re: psycopg2 problem
Yeah, it's all spelled fine (not like I typed it there, sorry!) and the database exists. Obviously if web2py was connecting to PostgreSQL it would give a database not found or a cannot write to database error or something, not a python cannot find psycopg2 module. I think now that the question that needs answering is why can't WSGI web2py see psycop2 even though terminal web2py can...? I'm not gonna say BUG, but I can't work out what Im doing wrong! On Apr 2, 1:40 am, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 4:40 pm, Richie richie.d...@googlemail.com wrote: From command line python db = DAL('postgres://posttg...@localhost: 5432/appdb') gives a FATAL: no pg_hba.conf entry for host 127.0.0.1, user postgres, database appdb, SSL off but this is a different issue that I can sort out later! It is still accessing that postgres server to get that error, which web2py isn't. A really basic check: have you created the database, appdb, and given it no-password rights to user posttgres (? is that use spelled correctly???) for at least read and modify? - Yarko import psycopg2 works perfectly. Seems like web2py's dal.py module cannot find psycop2 even though command line python can, but I have no idea why. Path probs? I'm clueless! On Apr 1, 9:55 pm, Thadeus Burgess thade...@thadeusb.com wrote: And to triple make sure... from the shell printing sys.version gives exactly the same, date, revision, GCC version ? mod_wsgi was compiled with the same version of python installed? So just to make sure you only get the GlobalName when you access web2py through mod_wsgi ? tburg...@***-dev:~/Applications/web2py$ python web2py.py -S welcome db = DAL('postgres://user:p...@localhost:1234/database') Correct? and tburg...@***-dev:~/Applications/web2py$ python import psycopg2 -Thadeus On Thu, Apr 1, 2010 at 2:46 PM, Richie richie.d...@googlemail.com wrote: Worked fine.. 2.5.2 (r252:60911, Jan 20 2010, 23:30:56) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] Same version! Extra confused now... On Apr 1, 9:42 pm, Thadeus Burgess thade...@thadeusb.com wrote: So mod_wsgi will not let you print, try this (before your db=DAL(...) statement) import sys tmp_file = open('/path/to/a/writable/file.txt', 'w') tmp_file.write(sys.version) tmp_file.close() db = DAL(...) Try and access default controller (you will get an error, but now we have a file) Open up the file, and make sure the version corresponds to the one your shell is using. Probably not the most elegant way, but its quick. -Thadeus On Thu, Apr 1, 2010 at 2:39 PM, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group
Re: [web2py] Re: Validation per object
I actually have an example for this kind of form. Say I have two Records, Person 124 and Person 532. Well come to find out, record 124 and 532 are the exact same person who signed up twice. I want to merge the two records together and leave with just one, but oh noes 532 has more up to date info than 124. So I want to display both records, side by side, with some radio buttons A and B for each record. If the radio button has A as a value when it comes in, I take from Record A( in this case, Person 124)., If the radio button has a value of B, I take record 532. So in this case, I cannot use SQLFORM (I could, but its much easier to just use a manual form, and manually validate the request.vars) -Thadeus On Thu, Apr 1, 2010 at 6:34 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 5:04 pm, carlo syseng...@gmail.com wrote: sorry for this out of sync answer but though I managed some tricks to tackle the (problem of) validation in pure html forms during these years, I would be curious about an answer to Mengu's request of showing how to make validation with manual forms. When I need to do this, I do it with making a memory-based table, and SQLFORM or SQLFORM.factory, and do whatever validation I need. Sorry DenesL but you did not answer the question as you supposed a model in place, so I would really appreciate a simple html form which preserves validation. Thank you There is a fundamental fuzziness around this: If you have manual forms without data persistence, what are you validating? (and what can you not do by building up a simpel memory-db model, and validating transient data against that?) Second - if it is _really_ transient data that you are validation, then even memory db, per request, could get pretty heavy in terms of server load - why not do client-side validation? Either way, this begs the question: why exactly this form of question? I want to know the reasons / situation / logic behind this specific (server-side, no data persistence, no temporary, memory model of the data) request. As it stands, it seems to me to be missing some key information / motivations. Yarko carlo On 15 Mar, 21:09, DenesL denes1...@yahoo.ca wrote: On Mar 15, 6:28 am, Mengu whalb...@gmail.com wrote: First of all, I am not sure what is the problem you are trying to solve. Even if you havecustomformsand you build all the form html manually you can still use the existing validation mechanism. I don't want to use crud or sqlform or any html helper. i build my formsmanually. and actually if you show me how to make validation with manualforms, it would be good. You could set the error messages in the requires db.users.name.requires = IS_NOT_EMPTY(error_message = Please enter your name) db.users.email.requires = [ IS_EMAIL(error_message=Given e-mail is not a valid one.), IS_NOT_IN_DB(db,'users.email',error_message=Sorry, this e-mail already exists in our database) ] create your form with the same field names and to check them do for n,v in request.vars.items(): rr=db.users[n].requires if isinstance(rr,list): t,e=v,None for r in rr: t,e=r(t) if e: break else: t,e=rr(v) if e: form.errors[n]=e # here do whatever you need to do with form.errors Denes -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: psycopg2 problem
It still must be a problem with the site-packages. And I wonder if it has something to do with the fact you had problems with easy_install. I would try apt-get remove python-psycopg2 then look in your site-packages, make sure to remove ALL instances of psycopg2 egg or src files. Also check your local user instance of python modules. Then once you are sure its clean, attempt to reinstall with apt-get. -Thadeus On Thu, Apr 1, 2010 at 8:50 PM, Richie richie.d...@googlemail.com wrote: Yeah, it's all spelled fine (not like I typed it there, sorry!) and the database exists. Obviously if web2py was connecting to PostgreSQL it would give a database not found or a cannot write to database error or something, not a python cannot find psycopg2 module. I think now that the question that needs answering is why can't WSGI web2py see psycop2 even though terminal web2py can...? I'm not gonna say BUG, but I can't work out what Im doing wrong! On Apr 2, 1:40 am, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 4:40 pm, Richie richie.d...@googlemail.com wrote: From command line python db = DAL('postgres://posttg...@localhost: 5432/appdb') gives a FATAL: no pg_hba.conf entry for host 127.0.0.1, user postgres, database appdb, SSL off but this is a different issue that I can sort out later! It is still accessing that postgres server to get that error, which web2py isn't. A really basic check: have you created the database, appdb, and given it no-password rights to user posttgres (? is that use spelled correctly???) for at least read and modify? - Yarko import psycopg2 works perfectly. Seems like web2py's dal.py module cannot find psycop2 even though command line python can, but I have no idea why. Path probs? I'm clueless! On Apr 1, 9:55 pm, Thadeus Burgess thade...@thadeusb.com wrote: And to triple make sure... from the shell printing sys.version gives exactly the same, date, revision, GCC version ? mod_wsgi was compiled with the same version of python installed? So just to make sure you only get the GlobalName when you access web2py through mod_wsgi ? tburg...@***-dev:~/Applications/web2py$ python web2py.py -S welcome db = DAL('postgres://user:p...@localhost:1234/database') Correct? and tburg...@***-dev:~/Applications/web2py$ python import psycopg2 -Thadeus On Thu, Apr 1, 2010 at 2:46 PM, Richie richie.d...@googlemail.com wrote: Worked fine.. 2.5.2 (r252:60911, Jan 20 2010, 23:30:56) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] Same version! Extra confused now... On Apr 1, 9:42 pm, Thadeus Burgess thade...@thadeusb.com wrote: So mod_wsgi will not let you print, try this (before your db=DAL(...) statement) import sys tmp_file = open('/path/to/a/writable/file.txt', 'w') tmp_file.write(sys.version) tmp_file.close() db = DAL(...) Try and access default controller (you will get an error, but now we have a file) Open up the file, and make sure the version corresponds to the one your shell is using. Probably not the most elegant way, but its quick. -Thadeus On Thu, Apr 1, 2010 at 2:39 PM, Richie richie.d...@googlemail.com wrote: @Thadeus Statement 1 it is. How do I check the version mod_wsgi is using? I really appreciate the help! On Apr 1, 9:22 pm, Thadeus Burgess thade...@thadeusb.com wrote: We are confused. 1) He said he gets the error when I try to access default controller. 2) He did not say I try to access psycopg2 from my controller. I take what he said to mean (statement 1) he cannot connect to postgres with web2py. Perhaps he really ment statement 2, in which you are correct. -Thadeus On Thu, Apr 1, 2010 at 2:16 PM, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 1, 3:12 pm, Thadeus Burgess thade...@thadeusb.com wrote: Make sure mod_wsgi is running the same version of python that you have psycopg2 installed. that is not the point / problem here; anyway, python web2py.py -S welcome, and an attempt to import psycopg2 from that shell will show that you can import it fine from the web2py app level; gluon.dal imports it, and your app doesn't get to see it for a reason. -Thadeus On Thu, Apr 1, 2010 at 1:48 PM, Richie richie.d...@googlemail.com wrote: I can import psycopg2 from a python shell, but I'm getting NameError: global name 'psycopg2' is not defined when I try to access my default controller. I'm setup with Apache and MOD WSGI. Anyone got any ideas? Thanks! Rich -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe
[web2py] Import modules not working
Hi I tried to install the clienttools.py module found here http://www.web2pyslices.com/main/slices/take_slice/8 However when in my application controller I try to import the module by doing the following: clienttools = local_import('clienttools') page = clienttools.PageManager(globals()) event = clienttools.EventManager(page) js = clienttools.ScriptManager(page) # javascript helpers jq = clienttools.JQuery # don't instantiate, just to shorten I get the following error: Traceback (most recent call last): File C:\web2py\gluon\restricted.py, line 173, in restricted exec ccode in environment File C:\web2py\applications\mlinks/controllers/ backend.py:GenerateLinksBetweenSites, line 26, in module File C:\web2py\gluon\compileapp.py, line 258, in lambda local_import_aux(name,reload,app) File C:\web2py\gluon\compileapp.py, line 196, in local_import_aux exec(import %s as mymodule % name) in env File string, line 1, in module ImportError: No module named applications.mlinks.modules.clienttools the clienttools.py file is in the modules directory of my application. What am I doing wrong? Thanks -Miguel PS: I am running on the gae locally (devserver) -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: New Python IDE for Windows/Mac/Linux
yet another complex, powered by jetbrains ide. i think these guys know how to develop but don't know what is an ide. however it looks good. by the way, i'm also developing a web development ide (http:// www.mengu.net/post/a-new-web-development-ide) so i hate competition. :D On 2 Nisan, 02:38, mikech mp.ch...@gmail.com wrote: Pycharm:http://www.jetbrains.com/pycharm/index.html -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.