[web2py] widgets in db.py

2010-03-20 Thread Avik Basu
Hi, I have a several widgets in a file called widgets.py and would like to use those widgets in db.py. Both db.py and widgets.py exist in the models directory. However, when I use the widgets in defining table fields in db.py, it does not recognize the widgets. How can I include the widgets.py

[web2py] Passing values to widgets

2010-03-26 Thread Avik Basu
Is there a way to pass arguments to a field's widget from the controller? For example: db.define_table(food, Field(name, string')) db.define_table(units, Field(food_id, db.food), Field(name, string) ) db.define_table(ate, Field(food_id, db.food), Field(quantity, double),

[web2py] Re: Passing values to widgets

2010-03-27 Thread Avik Basu
would be the proper way to call the widget constructor? Avik On Mar 27, 12:02 am, mdipierro mdipie...@cs.depaul.edu wrote: in the controller you can do db.table.field.widget = SomeWidgetConstructor(args) Not sure if this is what you are asking. On 26 Mar, 18:26, Avik Basu avikb

[web2py] Re: Passing values to widgets

2010-03-27 Thread Avik Basu
           #using args         return widget db.ate.units.widget = Units_Widget(food_id) On Mar 27, 10:42 am, Avik Basu avikb...@gmail.com wrote: So, for my example, I tried your suggestion.  I defined a widget in models/widgets.py: def units_widget(field,value,food_id

[web2py] Re: Passing values to widgets

2010-03-27 Thread Avik Basu
Also, if i wanted to extend SQLFORM.widgets.options.widget, how would i go about doing that? Is it as simple as replacing: class Units_Widget(object): with: class Units_Widget(SQLFORM.widgets.options.widget): Thanks, Avik On Mar 27, 5:03 pm, Avik Basu avikb...@gmail.com wrote: I get

[web2py] Re: Passing values to widgets

2010-03-27 Thread Avik Basu
, 4:05 pm, Avik Basu avikb...@gmail.com wrote: Also, if i wanted to extend SQLFORM.widgets.options.widget, how would i go about doing that? Is it as simple as replacing: class Units_Widget(object): with: class Units_Widget(SQLFORM.widgets.options.widget): Thanks, Avik On Mar

[web2py] datetime and represent

2010-03-28 Thread Avik Basu
I would like to use the represent function on a datetime object, like so: from datetime import * db.define_table(adate, Field(date,datetime, represent = lambda x: x.strftime(%a %m-%d-%y) if x else 'No time' #convert datetime object to string ) ) This works when I create a form,

[web2py] Re: datetime and represent

2010-03-28 Thread Avik Basu
. Massimo On Mar 28, 4:54 pm, Avik Basu avikb...@gmail.com wrote: I would like to use the represent function on a datetime object, like so: from datetime import * db.define_table(adate,   Field(date,datetime,      represent = lambda x: x.strftime(%a %m-%d-%y) if x else 'No time

[web2py] Re: datetime and represent

2010-03-28 Thread Avik Basu
in trunk or also in 1.76.5. Which web2py version do you use? Massimo On Mar 28, 6:18 pm, Avik Basu avikb...@gmail.com wrote: I dropped all the records in the table and still get the same result. I replaced the previous represent with: represent = lambda x: type(x) which shows

[web2py] crud update with represent

2010-04-01 Thread Avik Basu
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

[web2py] Re: crud update with represent

2010-04-03 Thread Avik Basu
1, 2:22 pm, Avik Basu avikb...@gmail.com wrote: 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

[web2py] Re: LOAD and reload

2010-04-09 Thread Avik Basu
On Apr 9, 5:07 pm, Avik Basu avikb...@gmail.com wrote: Hi, Is there a way to reload a component that has been loaded with the LOAD function without sending a request back to the server? For example, I would like to reload a list of foods whenever the data has been altered by the user

[web2py] restart web2py command line

2010-04-29 Thread Avik Basu
Hi, Is there a way to restart web2py from the command line in a linux environment? Avik

[web2py] cache.disk.clear

2010-05-03 Thread Avik Basu
Hi, I have installed a site on dreamhost and whenever I issue the command cache.disk.clear in an action, I get an invalid function error. I thought this could be a permissions problem for the cache directory or cache.shelve, so I added read/write permissions for everyone, but it didn't seem to

[web2py] Re: cache.disk.clear

2010-05-04 Thread Avik Basu
to work for me. On May 3, 6:25 pm, Avik Basu avikb...@gmail.com wrote: Hi, I have installed a site on dreamhost and whenever I issue the command cache.disk.clear in an action, I get an invalid function error. I thought this could be a permissions problem for the cache directory

[web2py] MySQL failure to connect

2010-05-18 Thread Avik Basu
Hello, I am having some trouble connecting to a MySQL server running on my local machine (Macbook Pro running Snow Leopard with My SQL 5.1.46). I use the following connection string: db = DAL('mysql://root:passw...@localhost/test', pool_size=10) and I get the following error: Traceback (most

[web2py] Re: MySQL failure to connect [SOLVED]

2010-05-19 Thread Avik Basu
Turns out I was not running from source. Thanks for your help! Avik On May 19, 7:53 am, Alexandre Andrade alexandrema...@gmail.com wrote: the correct driver is not python-mysql, but mysqldb. 2010/5/18 Avik Basu avikb...@gmail.com Hello, I am having some trouble connecting to a MySQL

[web2py] An error occurred importing your passenger_wsgi.py

2010-05-31 Thread Avik Basu
I am running on web2py 1.78.3 on a shared server on Dreamhost and I am getting the following error: An error occurred importing your passenger_wsgi.py It seems like a PATH issue but I'm not sure. Any ideas what might be causing this? Avik

[web2py] synchronize tables in two databases

2010-06-28 Thread Avik Basu
Hi, I'm trying to synchronize two databases that are similar but not exactly the same. I would like to create two connections (db1 and db2) and go through table by table to do the synchronization. db1 = DAL('sqlite://storage.db') db2 = DAL('mysql://username:passw...@mysql.test.com/test_db',

[web2py] MySQL query with empty belongs

2010-07-12 Thread Avik Basu
Hi, I am trying to run a query with the web2py belongs statement where sometimes the value passed to the belongs may be empty. For example, a=[] rows = db(db.food.id.belongs(a)).select() The database I'm using is MySQL and I get the following error: Traceback (most recent call last): File

[web2py] prevent redirect when using crud.delete

2010-09-14 Thread Avik Basu
Hello, Is there a way to prevent crud.delete from redirecting to a new page. The reason I want to do this is that I am calling crud.delete via web2py's LOAD function? I am trying this: form = crud.delete(db.ate,ate_id, next='') I notice in the code that crud.update explicitly checks for an

[web2py] StorageList error on Dreamhost installation

2010-09-14 Thread Avik Basu
Hi, I get the following error when loading web2py version 1.84.4 on Dreamhost: Traceback (most recent call last):\n File gluon/restricted.py, line 178, in restricted in code it raises a RestrictedError containing the traceback. layer is \n File

[web2py] Re: StorageList error on Dreamhost installation [SOLVED]

2010-09-14 Thread Avik Basu
I restarted the server and the issue was resolved. Sorry for the bother. Avik On Sep 14, 6:24 pm, Avik Basu avikb...@gmail.com wrote: Hi, I get the following error when loading web2py version 1.84.4 on Dreamhost: Traceback (most recent call last):\n  File gluon/restricted.py, line 178

[web2py] URL error in appadmin

2010-09-17 Thread Avik Basu
Hi, I get the following error in appadmin.py which I copied over from the welcome app in version 1.85.2: Traceback (most recent call last): File /Volumes/Data/avikbasu/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File

[web2py] Re: URL error in appadmin

2010-09-17 Thread Avik Basu
://127.0.0.1:8000/FWv9_1_Avik/appadmin/index). Is there some other file I need to copy? Avik On Sep 17, 7:24 pm, Jonathan Lundell jlund...@pobox.com wrote: On Sep 17, 2010, at 4:06 PM, Avik Basu wrote: Hi, I get the following error in appadmin.py which I copied over from the welcome app

[web2py] Re: URL error in appadmin

2010-09-18 Thread Avik Basu
There is nowhere I can see that I am altering request in the models. What is the specific reason that request would break the URL function? Any other ideas what the problem could be? Avik On Sep 17, 7:57 pm, Jonathan Lundell jlund...@pobox.com wrote: On Sep 17, 2010, at 4:44 PM, Avik Basu

[web2py] Re: URL error in appadmin

2010-09-18 Thread Avik Basu
Sure, I'm happy to help debug. Send me the print statements when you get a chance. Avik On Sep 18, 12:39 pm, Jonathan Lundell jlund...@pobox.com wrote: On Sep 17, 2010, at 11:50 PM, Avik Basu wrote: There is nowhere I can see that I am altering request in the models. What is the specific

[web2py] Re: URL error in appadmin

2010-09-18 Thread Avik Basu
the html.pyc file. Do I need to restart the server? On Sep 18, 2:31 pm, Jonathan Lundell jlund...@pobox.com wrote: On Sep 18, 2010, at 9:46 AM, Avik Basu wrote: Sure, I'm happy to help debug.  Send me the print statements when you get a chance. FWIW, I just did the same thing (move the current

[web2py] Re: URL error in appadmin

2010-09-18 Thread Avik Basu
After restarting the server, I get the following error: SyntaxError: URL: a=index c=None f=None r=None On Sep 18, 2:46 pm, Jonathan Lundell jlund...@pobox.com wrote: On Sep 18, 2010, at 11:40 AM, Avik Basu wrote: When I replace the code in gluon/html.py, I still keep getting the same

[web2py] Re: URL error in appadmin

2010-09-18 Thread Avik Basu
the following syntax error: SyntaxError: URL: a=index c=None f=None r=None u=URL On Sep 18, 3:33 pm, Jonathan Lundell jlund...@pobox.com wrote: On Sep 18, 2010, at 11:52 AM, Avik Basu wrote: After restarting the server, I get the following error: SyntaxError: URL: a=index c=None f=None r=None I

[web2py] Re: URL error in appadmin

2010-09-18 Thread Avik Basu
do i need to import logging? On Sep 18, 4:10 pm, Jonathan Lundell jlund...@pobox.com wrote: On Sep 18, 2010, at 12:52 PM, Avik Basu wrote: Line 219 of gluon/compileapp.py is as you described it. I also deleted the whole gluon directory and downloaded the latest source of web2py before

[web2py] Re: URL error in appadmin

2010-09-18 Thread Avik Basu
page, I get the same syntax error that I had in appadmin. On Sep 18, 4:10 pm, Jonathan Lundell jlund...@pobox.com wrote: On Sep 18, 2010, at 12:52 PM, Avik Basu wrote: Line 219 of gluon/compileapp.py is as you described it. I also deleted the whole gluon directory and downloaded the latest

[web2py] Re: URL error in appadmin

2010-09-18 Thread Avik Basu
ideas? On Sep 18, 2010, at 1:24 PM, Avik Basu wrote: I put this: {{=URL.__name__}} in the view of my index page and it showed URL (not _URL as you said) Also, I don't know if its helpful to mention that the latest format for the URL function is not working anywhere in my app

[web2py] Re: URL error in appadmin

2010-09-18 Thread Avik Basu
I tried your suggestion and tracked the error to the following line which was in my db.py: from gluon.sqlhtml import * I guess this import overrided the URL function. When I took it out, everything works. Thanks so much for your patience and helping me get through this issue so methodically!

[web2py] expose URL to internal web2py functions

2010-09-20 Thread Avik Basu
I have a generic function called edit_db which allows for editing of database records and is useful for ajax-related form functions such as edit-in-place. The URL that is exposed is something like edit_db/tablename/row_id/fieldname?value=newvalue I would like to make sure that this function can

[web2py] Re: expose URL to internal web2py functions

2010-09-21 Thread Avik Basu
access with @auth.requires_login() or other auth recorator. On Sep 20, 6:48 pm, Avik Basu avikb...@gmail.com wrote: I have a generic function called edit_db which allows for editing of database records and is useful for ajax-related form functions such as edit-in-place.  The URL

[web2py] logging cannot create a log file when run from web2py

2010-10-27 Thread Avik Basu
logging.basicConfig(filename='logging.log',level=logging.INFO) logging.info('test') #command used to run the above file python web2py.py -M -N -S test -R applications/test/cron/log.py Thanks. Avik Basu

[web2py:33386] Re: OPTION selected problem

2009-10-21 Thread Avik Basu
=... OPTION('candy', _selected=selected, _value=1) should produce what you are looking for. However, when using SQLFORM the default selection can be set as well when you specify field.default =... -Thadeus On Wed, Oct 21, 2009 at 9:26 PM, Avik Basu avikb...@gmail.com wrote: Hello, I

[web2py] register recepatcha not working

2011-09-17 Thread Avik Basu
I am using recaptcha using the following code (public and private keys not shown): auth.settings.register_captcha = Recaptcha(request, '', 'yy', use_ssl=False, error_message='please complete the reCaptcha') I've registered with recaptcha.net and I not running this from a