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
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),
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
#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
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
, 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
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,
.
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
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
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
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
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
Hi,
Is there a way to restart web2py from the command line in a linux
environment?
Avik
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
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
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
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
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
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',
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
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
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
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
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
://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
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
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
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
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
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
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
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
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
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!
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
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
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
=...
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
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
39 matches
Mail list logo