[web2py] running epydoc on modules that use current

2012-05-28 Thread Ed Greenberg
I was happy to find that I could do 'from gluon import current' in my modules, and get access to the various treasures that lie within ;) Recently I went to try and run epydoc on my modules directory, so that I could have some doc while writing code, and discovered that epydoc gets an error

[web2py] exceptions in modules

2012-03-22 Thread Ed Greenberg
: Unexpected error:class 'applications.gw.modules.CustomException.CustomException' The two classes match, yet I cannot catch the exception. I hope somebody can point out the error of my ways... Ed Greenberg

[web2py] Re: exceptions in modules

2012-03-22 Thread Ed Greenberg
I have to point out that my line except CustomException.CustomException: was earlier just except CustomException: The first version was an attempt during testing, and was accidentally pasted into the message. I've also tried except CustomException as e: and except CustomException,

[web2py] Access to app variables in modules

2012-02-26 Thread Ed Greenberg
I create lots of modules which need to interact with my app. I've been passing things into them and wonder if I'm doing the simplest and best practice: aObj=local_import(a,reload=True) a=aObj(db,auth,settings,session,module_specific_params) Then, in the class, I use them as self.settings.foo

[web2py] DAL: select column in (a,b)

2012-02-11 Thread Ed Greenberg
I feel like I should know this. I've searched, but Google doesn't really allow for the word in as it's too short and common. I'd like to do select column in (a,b) in the dal. Any idea how? Thanks, Ed

[web2py] Re: DAL: select column in (a,b)

2012-02-11 Thread Ed Greenberg
belongs() Thanks. On Feb 11, 7:09 am, Marin Pranjić marin.pran...@gmail.com wrote: http://web2py.com/books/default/chapter/29/6#belongs Marin On Sat, Feb 11, 2012 at 12:34 PM, Ed Greenberg greenberg...@gmail.comwrote: I feel like I should know this. I've searched, but Google

[web2py] Default controller function

2012-01-31 Thread Ed Greenberg
I have some html files which I want to render inside the layout. Something like this: {{extend 'layout.html'}} div id=homeContent content goes here /div All it needs is an empty dict, since it won't look for anything from the controller to customize it. I put this file in

[web2py] DAL and date calculations

2012-01-28 Thread Ed Greenberg
Using the DAL, I'd like to select records that are less than some interval old, or newer than a certain date. My records have a datetime field in them. So I want something like: select * from table where mydate (now()-interval 1 day) Can I do this in the dal, or do I have to use raw sql?

[web2py] Re: web2py and FirePHP

2011-11-22 Thread Ed Greenberg
20, 4:37 pm, Ed Greenberg greenberg...@gmail.com wrote: I happened upon this old thready from 2009:https://groups.google.com/group/web2py/browse_thread/thread/cc13960a5... But unfortunately, the link to the code has become 404 and the thread has died. Is anybody using the module

[web2py] web2py and FirePHP

2011-11-20 Thread Ed Greenberg
what had previously been found at http://www.box.com/shared/dtm0dhgze9 Did it work? Many thanks Ed Greenberg

[web2py] IS_NOT_IN_DATABASE with a formatted value

2011-10-08 Thread Ed Greenberg
I have a table of US phone numbers in ten digit form. When I store them, I take out all non-numeric characters using: def cleanUpNumber(number): return re.sub(r'\D',,number)[-10:] I use a FORM() to get the numbers. Not a SQLFORM or CRUD. I would like to use IS_NOT_IN_DATABASE(...) to make

[web2py] Re: IS_NOT_IN_DATABASE with a formatted value

2011-10-08 Thread Ed Greenberg
',     requires=lambda v: IS_NOT_IN_DB(db, 'yourtable.phone')(cleanUpNumber(v Anthony On Saturday, October 8, 2011 8:10:51 AM UTC-4, Ed Greenberg wrote: I have a table of US phone numbers in ten digit form. When I store them, I take out all non-numeric characters using

[web2py] export to csv - no header row

2011-06-29 Thread Ed Greenberg
Looking at the code to gluon.dal.Rows.export_to_csv(), it does not seem possible to suppress the header on the first line. Is there a way to do this?

[web2py] Enabling logging

2011-05-11 Thread Ed Greenberg
Hi, I'd like to enable logging so I can see the various warnings that web2py might be issuing. I am running Version 1.91.6 (2011-01-03 17:55:14), using apache2 and WSDL on Centos 5.5. I copied logging.example.conf to logging.conf, and restarted apache. I would expect to see logging on the

[web2py] Re: Enabling logging

2011-05-11 Thread Ed Greenberg
I found my log messages. When using consoleHandler with apache/WSDL, apparently, the logging messages go to the server error log, not the console.

[web2py] Mail.send failure:login() takes exactly 3 arguments (2 given)

2011-05-11 Thread Ed Greenberg
When trying to send registration or lost password email, web2py flashes that it cannot send email (so registration fails) and logs [Wed May 11 10:07:31 2011] [error] 2011-05-11 10:07:31,049 - web2py - WARNING - Mail.send failure:login() takes exactly 3 arguments (2 given) My app's db.py says:

[web2py] Re: Mail.send failure:login() takes exactly 3 arguments (2 given)

2011-05-11 Thread Ed Greenberg
:                     ...                     server.login(*self.settings.login.split(':',1)) I think you must have somewhere a statement like auth.settings.login = ... and the ... is missing a : separating username and password. On May 11, 5:13 am, Ed Greenberg greenberg...@gmail.com wrote: When trying

[web2py] Re: Login problems with _formkey changing

2011-05-06 Thread Ed Greenberg
My user had success (and closed his issue) after removing all Firefox add-ons. Thank you.

[web2py] Re: Login problems with _formkey changing

2011-04-28 Thread Ed Greenberg
On Apr 27, 12:06 pm, pbreit pbreitenb...@gmail.com wrote: Is this the standard login code or has it been customized in any way? It's the standard login code. Other than a few syslog calls, my entire gluon directory is absolutely the way it came from web2py.

[web2py] Login problems with _formkey changing

2011-04-27 Thread Ed Greenberg
I have a user of my app that is unable to log in with his (Ubuntu) Firefox browser. He can log in with Chrome, and others can log in with various flavors of Firefox. He's cleared his caches, cleared his cookies, and done all sorts of similar browser cleansing things. I found that his

[web2py] epydoc behavior

2011-04-09 Thread Ed Greenberg
Hi Folks, Not really a web2py question, but it affects me daily. When running the epydoc web pages at http://web2py.com/examples/static/epydoc/frames.html, I get odd behavior, and I wonder if it's just me, or if everybody sees this: Whenever I hit source code for a function, the large frame

[web2py] AttributeError: 'Recaptcha' object has no attribute 'options'

2011-03-20 Thread Ed Greenberg
Following the book, I do this in db.py, after auth has been instantiated. from gluon.tools import Recaptcha auth.settings.captcha = Recaptcha(request,'6LczqcISA...cAoH','6L...L2') and I get a ticket: AttributeError: 'Recaptcha' object has no attribute 'options' Any ideas? Traceback below. Ed

[web2py] Re: Log the user out

2011-03-11 Thread Ed Greenberg
This returns me to /default/index with the flash of Logged out. My response.flash, specified below the auth.logout() is never seen. I also tried it with the response.flash= statement ABOVE the auth.logout(). The user gets logged out, but I have no control over what he sees next. Do you have any

[web2py] Re: Log the user out

2011-03-02 Thread Ed Greenberg
further suggestions, I'm very interested. Ed On Mar 1, 2:26 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: this should work, no? def index():     auth.logout()     response.flash=bye bye user On Mar 1, 1:12 pm, Ed Greenberg greenberg...@gmail.com wrote: At the end of my controller

[web2py] Log the user out

2011-03-01 Thread Ed Greenberg
At the end of my controller function, I'd like to log the user out and send him back to the login screen, hopefully with a response.flash on the screen. I've tried several things, none of which work. I tried sending him to URL(c='default',f='user',args=('logout')) which got close. One was

[web2py] join produces odd row object

2011-02-22 Thread Ed Greenberg
In my 'room' controller, I did this: def list(): rooms = db((db.rooms.customer==session.customer_id)(db.rooms.property==db.properties.id)).select(db.rooms.ALL, db.properties.ALL, orderby=db.properties.short_desc) return dict(rooms=rooms) which I thought was way cool. In my

[web2py] SQLFORM hide some fields

2011-02-16 Thread Ed Greenberg
I'd like to suppress some fields in a SQLFORM. Imagine that a user is filling out a form to create or edit a record, and his user_id is a column in the record. We need to populate the user_id, but he should never see it. If I declare the field as writable=False,readable=False then nobody with

[web2py] Re: SQLFORM hide some fields

2011-02-16 Thread Ed Greenberg
These look like exactly what I'm looking for. I'll try 'em out. Thanks.

[web2py] Re: SQLFORM limit contents of dropdown

2011-02-15 Thread Ed Greenberg
sql : Why is the same sql failing in web2py that is succeeding in the mysql program. Perhaps I'm only seeing a fragment of what web2py submitted to mysql? How can I see the whole thing? Many thanks. Ed Greenberg On Feb 14, 4:19 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: def index

[web2py] Re: SQLFORM limit contents of dropdown

2011-02-15 Thread Ed Greenberg
15, 2:13 pm, Ed Greenberg greenberg...@gmail.com wrote: Sorry to be back with a request for clarification. My relationship is that a customer has properties and a property has rooms. I did this...     customer_id = session.customer_id     query = select id from properties where

[web2py] SQLFORM limit contents of dropdown

2011-02-14 Thread Ed Greenberg
visible). A crud won't work reliably -- it's too generic. Do I have to create my own form and populate my dropdown, or can I have SQLFORM do the work in some fashion? Thanks Ed Greenberg

[web2py] Subclassing Login or getting code to run every time a user logs in

2011-02-14 Thread Ed Greenberg
I'd like to store some session variables on login. (Look the userid up in another table and get some convenient stuff out of there. ) Is there any way to tag onto the Auth login method AFTER login is successful and before it redirects to whatever is specified in the _next argument? Thanks, Ed

[web2py] Re: SQLFORM limit contents of dropdown

2011-02-14 Thread Ed Greenberg
, Ed Greenberg greenberg...@gmail.com wrote: When SQLFORM constructs an HTML form with a dropdown of foreign keys, I need to limit the records to only those that match a certain where clause. This is a master-detail problem. For instance, when displaying a detail form,  we only want some

[web2py] apache, wsgi, redirect http to https

2011-02-12 Thread Ed Greenberg
I'd like to redirect http to https so that users who don't specify https are forced to use it, especially for login/password transactions. Also it would be nice if the admin pages, which are blocked in http, would redirect, rather than fail. There were some postings about htaccess in the group,

[web2py] What user is logged in (or, restricting access based on user)

2011-02-11 Thread Ed Greenberg
best practice for this, as well. Can somebody please explain. Thanks, Ed Greenberg

[web2py] insert into table where fields and values are in a dict

2011-02-01 Thread Ed Greenberg
If I call db.tablename.insert(...) it expects individual column-value pairs. I already have these in a dict (which has been pre-screened for valid columns and types). Is there a way to call insert with this dict, or to properly explode the values into something I can pass to insert? Thanks.

[web2py] Re: Another instance of No such file or directory: '/opt/web-apps/web2py/applications/admin/..

2011-01-27 Thread Ed Greenberg
you please open a googlecode issue? On Jan 25, 9:28 pm, Ed Greenberg greenberg...@gmail.com wrote: I have a new centos installation. I followed the script athttp://web2pyslices.com/main/slices/take_slice/98. When I use the new application wizard,  I get the same traceback that others have

[web2py] creating html for the user to save or copy/paste

2011-01-27 Thread Ed Greenberg
I have a controller function that we can call next() since that's what it is called :) I have created a block of html in that function, contained in a string. I'd like to return it to the user so he can reuse it (not just view it in the browser.) Sending it to the browser causes the various

[web2py] Another instance of No such file or directory: '/opt/web-apps/web2py/applications/admin/..

2011-01-26 Thread Ed Greenberg
I have a new centos installation. I followed the script at http://web2pyslices.com/main/slices/take_slice/98. When I use the new application wizard, I get the same traceback that others have posted: Traceback (most recent call last): File /opt/web-apps/web2py/gluon/restricted.py, line 188, in