Re: [web2py] Trying to use dict to filter values for a 2nd dropdown list based on the value of 1st dropdown list

2013-11-07 Thread Kiran Subbaraman
Maybe this will help: http://www.web2pyslices.com/slice/show/1724/cascading-dropdowns-simplified ? Kiran Subbaraman http://subbaraman.wordpress.com/about/ On 11/7/2013 10:09 PM, Dr. Bill Y.K. Lim wrote: Hi, I am new to Python and web2py and I am not sure

[web2py] response.files.append and response.files.insert

2013-11-07 Thread 黄祥
hi, just want to know what is the different response.files.append and response.files.insert. e.g. take from layout.html in the older version : {{ response.files.append(URL('static','css/web2py.css')) response.files.append(URL('static','css/bootstrap.min.css')) response.files.append(URL

Re: [web2py] Re: Scheduler - a second try

2013-11-07 Thread Jonathan Lundell
On 7 Nov 2013, at 9:00 PM, Andrew W wrote: > Well, I just added -D 0 when starting the scheduler and it prints to the > console. > Yes, we should add something, because after reading the logging sections of > the book I was sure I had to add something to the conf file. scheduler.py has this:

Re: [web2py] Re: Scheduler - a second try

2013-11-07 Thread Andrew W
Well, I just added -D 0 when starting the scheduler and it prints to the console. Yes, we should add something, because after reading the logging sections of the book I was sure I had to add something to the conf file. On Friday, November 8, 2013 3:46:29 PM UTC+11, Jonathan Lundell wrote: >

Re: [web2py] Re: Scheduler - a second try

2013-11-07 Thread Jonathan Lundell
On 7 Nov 2013, at 7:05 PM, Andrew W wrote: > Thanks. I've never been quite sure what to put in logging.conf for the > scheduler debug key, based on the "logger =" statement in scheduler.py. We should add a schedule section to the logging example file. -- Resources: - http://web2py.com - htt

[web2py] Re: Trying to use dict to filter values for a 2nd dropdown list based on the value of 1st dropdown list

2013-11-07 Thread Massimo Di Pierro
It is not working because you need the list of options when the form is generated, not when it is submitted, in fact this line is executed when the form is generated: db.auth_user.city.requires = IS_IN_SET(COUNTRIESANDCITIES[request.post_vars.country]) yet at this time the form is not submi

[web2py] Re: Scheduler - a second try

2013-11-07 Thread Andrew W
Thanks. I've never been quite sure what to put in logging.conf for the scheduler debug key, based on the "logger =" statement in scheduler.py. On Friday, November 8, 2013 6:59:17 AM UTC+11, Niphlod wrote: > logging is enabled as anything else in web2py. > just start the scheduler with > w

Re: [web2py] Custom login form error display

2013-11-07 Thread Anthony
On Thursday, November 7, 2013 8:24:19 PM UTC-5, Kiran Subbaraman wrote: > Look at the > > http://web2py.com/books/default/chapter/29/07/forms-and-validators#Hide-errors. > > > I think the errors are not displayed as usual, the moment you start > working with a customized form. Note, if you u

[web2py] Re: Custom login form error display

2013-11-07 Thread Anthony
You need to use form.custom.widget.fieldname to get the errors to display automatically. If you create your own tags manually in HTML, then you'll have to manually include the errors as well (the error for a given field is in form.errors.fieldname). Maybe something like: {{=DIV(form.errors.em

[web2py] Use view to generate a string

2013-11-07 Thread Scott Hunter
Is it possible to use a view to generate a string? In this particular case, I want to generate a snippet of HTML & cache it away. I suppose this could be done using straight python & helpers, but a view seems so much more natural. - Scott -- Resources: - http://web2py.com - http://web2py.co

Re: [web2py] Custom login form error display

2013-11-07 Thread Kiran Subbaraman
Look at the http://web2py.com/books/default/chapter/29/07/forms-and-validators#Hide-errors. I think the errors are not displayed as usual, the moment you start working with a customized form. You will need to handle that too. Kiran Subbaraman http://sub

[web2py] Re: urllib2.HTTPError

2013-11-07 Thread sonu kumar
One more thing I would like to say about this is: I am using 4 times urllib for calling same weblinks for different purposesWill this cause problem??? If yes how to solve this issue? params1 = {'from':'PDB_ID', 'to':'ACC', 'format':'tab', 'query':session.pdbid.strip()} data1 = urllib.ur

[web2py] urllib2.HTTPError

2013-11-07 Thread sonu kumar
Hi All, I have made one webserver on web2py. It runs perfectly sometime and sometime it throws error: HTTP Error 404: Not Found I am not able to understand it this error. Why my application runs smoothly sometime and sometime throws this kind of error. Here is Traceback: Traceback (most rec

[web2py] Re: Improving database performance

2013-11-07 Thread 黄祥
> > Q: I need to manipulate database contents in separate functions but if I > place the code to a separate module it can't connect to the database. > How can I access the database from separate module? Should I use the same > connection string in them as used in model files (db.py)? > please c

[web2py] Re: Problem retrieving documents for upload field

2013-11-07 Thread Niphlod
SQLFORM.factory has no notion of the table. The default naming scheme hence does "no_table" instead of "attachment". On Thursday, November 7, 2013 11:37:25 PM UTC+1, Jim S wrote: > > Just fixed my problem. > > Instead of doing the SQLFORM.factory, I just did a SQLFORM(db.attachment) > and set the

[web2py] Re: can a single component update multiple targets?

2013-11-07 Thread step
Thank you Cliff (and Derek), this works very well for me. On Wednesday, November 6, 2013 11:38:28 PM UTC+1, Cliff Kachinske wrote: > > I can't speak for Derek, but here's how I handle this stuff. > > foo > > > $('#to_be_updated).on('click', function(event){ > ajax('update_span', [ ], ':eval')

[web2py] Trying to use dict to filter values for a 2nd dropdown list based on the value of 1st dropdown list

2013-11-07 Thread Dr. Bill Y.K. Lim
Hi, I am new to Python and web2py and I am not sure if my approach below is correct - in any case I have a problem with it: I have added 2 extra fields in db.py as follows: from applications.myapp.modules.countriesandcities import * auth.settings.extra_fields['auth_user']=[ Field('country'),

[web2py] Custom login form error display

2013-11-07 Thread Ruud Schroen
Hi, I am building my login form with the form.custom.widget, because I don' like the standard layout of the forms. Now the problem is, I can't get the errors to display. Here is my controller: def login(): form=auth.login() if form.accepts(request,session): response.flash = 'form

[web2py] Improving database performance

2013-11-07 Thread Arto Huhtala
Hi, I am developing a test application with web2py to test database performance. The idea is to see how long does it take to fetch information from database on different loads. So far I have tested with SQLite and I've made test databases of size ~1K and 10K. Now I'm trying to test a ~100K and

[web2py] Re: Problem retrieving documents for upload field

2013-11-07 Thread Jim S
Just fixed my problem. Instead of doing the SQLFORM.factory, I just did a SQLFORM(db.attachment) and set the readable/writable attributes to false on the fields I didn't want to see. So, this works for me. Sorry for the noise. -Jim On Thursday, November 7, 2013 4:12:54 PM UTC-6, Jim S wrote:

[web2py] Re: Problem retrieving documents for upload field

2013-11-07 Thread Jim S
Just found something else interesting about this: I created one document using a test controller I'd created with a simple SQLFORM.grid in it. That one I can retrieve. There are 2 documents that were created with the SQLFORM.factory as detailed below, and they don't work. The one that was

[web2py] Re: configuring routes for web2py behind reverse proxy

2013-11-07 Thread DeanK
So I changed my reverse proxy set up to make debug a bit easier and maybe will get some suggestions from someone now: I have an instance of web2py running on nginx sitting behind an apache reverse proxy so: www.mydomain.com/linkpoints tomyserver1.otherdomain.com i have /myapp/defau

[web2py] Problem retrieving documents for upload field

2013-11-07 Thread Jim S
I have a table with an upload field: attachment = db.define_table('attachment', Field('attachmentId', 'id', readable=False), Field('name', length=50, label='Name', required=True), Field('employeeId', db.employee, label='Employee'), Field('ticketId', db.ticket, label='Ticket

Re: [web2py] OnSelect how to?

2013-11-07 Thread greenpoise
Hi Richard Thanks for the help. I keep looking. If I select the item from the autocomplete, I just want to grab the id and all the info pertaining to that record and put it in a session. I dont know how to do it. Do you have a better picture of my question? THanks again On Wednesday, Novemb

[web2py] Styling columns in SQLTABLE and the grid

2013-11-07 Thread Anthony
In trunk, SQLFORM.grid and SQLTABLE now include a element that includes a element for each column in the grid/table. Each col element includes a "data-column" attribute with the number of the column within the table (starting at 1). Columns that represent DAL table fields also have id's like

[web2py] Re: Converting python list into javascript array in views (web2py) ?

2013-11-07 Thread Niphlod
oh my. json_object *IS* an object (the name should have been pretty obvious). if you want the value of a, just do alert(t.a) On Thursday, November 7, 2013 9:30:31 PM UTC+1, Gaurav singh wrote: > > Sorry But its not working , its displying object obect in the pop up > > -- Resources: - htt

[web2py] Re: Converting python list into javascript array in views (web2py) ?

2013-11-07 Thread Gaurav singh
Sorry But its not working , its displying object obect in the pop up On Friday, 8 November 2013 01:20:30 UTC+5:30, Niphlod wrote: > > nope. > from gluon.serializers import json > > def index(): > python_object = dict(a=1, b=2) > return dict(json_object=json(python_object)) > > and then y

[web2py] Re: Scheduler - a second try

2013-11-07 Thread Niphlod
logging is enabled as anything else in web2py. just start the scheduler with web2py.py -K appname -D 0 to enable the DEBUG level. Of course logging.conf must be configured to allow DEBUG messages to be printed in the console. BTW: *Error cleaning up* shows up usually when the scheduler can't act

Re: [web2py] Difference between datetime.now and datetime.now()

2013-11-07 Thread Niphlod
/me too. I just don't bother with timezones (if not converting them client-side) and set all servers times to utc ^_^ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report

[web2py] Re: Problems with response.view =

2013-11-07 Thread Niphlod
put in your test.html an element and render the response.view value in it, so you'll know what actually is the response.view passed ... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/i

[web2py] Re: Converting python list into javascript array in views (web2py) ?

2013-11-07 Thread Niphlod
nope. from gluon.serializers import json def index(): python_object = dict(a=1, b=2) return dict(json_object=json(python_object)) and then you can do var t = {{=XML(json_object)}}; alert(t); in the view. On Thursday, November 7, 2013 8:28:23 PM UTC+1, Gaurav singh wrote: > > I

[web2py] Re: Converting python list into javascript array in views (web2py) ?

2013-11-07 Thread Gaurav singh
I am converting a python array p to javascript array using var t= {{=XML(response.json(p))}} but when i check it using alert(p); i get an empty pop up box :/ , Please help me On Saturday, 2 November 2013 19:40:34 UTC+5:30, Massimo Di Pierro wrote: > > What do you mean it is not? It should. Can y

[web2py] Re: Problems with response.view =

2013-11-07 Thread David
I am not getting an error, it just renders the view that would normally default to 'test.html' On Thursday, November 7, 2013 12:21:00 PM UTC-5, Massimo Di Pierro wrote: > > What error do you get? This should work fine. > > On Thursday, 7 November 2013 10:34:39 UTC-6, David wrote: >> >> Hello,

[web2py] Re: Import csv outside the web2py causes multiple entries in db corresponding to each column.

2013-11-07 Thread Derek
it looks like the id_map will tell it which column to use to map IDs, so it may do update or insert as appropriate. How convenient! On Thursday, November 7, 2013 11:38:57 AM UTC-7, Derek wrote: > > pass it the 'restore=True' to truncate the table before inserting. > Otherwise, it doesn't appear

[web2py] Re: Import csv outside the web2py causes multiple entries in db corresponding to each column.

2013-11-07 Thread Derek
pass it the 'restore=True' to truncate the table before inserting. Otherwise, it doesn't appear that the CSV import would do an 'insert or update'. On Monday, November 4, 2013 8:07:44 PM UTC-7, Sarbjit wrote: > > I am using import csv option to insert records in the database. When I use > the c

[web2py] Re: Insert Failed: Insufficient data left in message

2013-11-07 Thread Derek
It's a pervasive specific error, try seeing if there are any 0x00 characters in the 'message'. http://www.postgresql.org/message-id/481eb2fd.7060...@ikoffice.de On Thursday, November 7, 2013 12:58:46 AM UTC-7, at wrote: > > Yes except datetime fields; the all inserted values seem to be ok and

[web2py] Re: Installing the jqmobile plugin

2013-11-07 Thread Philip Kilner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Still digging on this. On 07/11/13 15:02, Philip Kilner wrote: > I'm having problems getting this working! > > My steps: - > - Create new app. > - Go to admin at /admin/default/site > - From admin, hit the "Try the mobile interface" link. > - Do

Re: [web2py] Difference between datetime.now and datetime.now()

2013-11-07 Thread Jonathan Lundell
On 7 Nov 2013, at 9:20 AM, Massimo Di Pierro wrote: > One can do > > request.now = request.utcnow > > For applications which are usually accessed from the same time-zip as the > server the current server makes it easier to set dates. I'm of course influenced by my own applications, with globa

[web2py] Re: Problems with response.view =

2013-11-07 Thread Massimo Di Pierro
What error do you get? This should work fine. On Thursday, 7 November 2013 10:34:39 UTC-6, David wrote: > > Hello, > > I am trying to use a different view for mobile devices but am not having > any luck using: > > response.view = 'test/test.mobile.html' > > in the controller as demonstrated in

Re: [web2py] Re: Difference between datetime.now and datetime.now()

2013-11-07 Thread Massimo Di Pierro
One can do request.now = request.utcnow For applications which are usually accessed from the same time-zip as the server the current server makes it easier to set dates. On Thursday, 7 November 2013 10:14:03 UTC-6, Jonathan Lundell wrote: > > Digressing slightly: it seems to me that one would

[web2py] Problems with response.view =

2013-11-07 Thread David
Hello, I am trying to use a different view for mobile devices but am not having any luck using: response.view = 'test/test.mobile.html' in the controller as demonstrated in http://www.web2py.com/init/default/examples example 4 Am I doing something wrong? David -- Resources: - http://web2p

Re: [web2py] Re: Difference between datetime.now and datetime.now()

2013-11-07 Thread Jonathan Lundell
Digressing slightly: it seems to me that one would ordinarily almost always want to use datetime.utcnow() rather that datetime.now(); likewise request.utcnow. At least in the database. On 7 Nov 2013, at 8:03 AM, Anthony wrote: > On Thursday, November 7, 2013 10:06:57 AM UTC-5, Jonathan Lundel

Re: [web2py] Re: Difference between datetime.now and datetime.now()

2013-11-07 Thread Anthony
On Thursday, November 7, 2013 10:06:57 AM UTC-5, Jonathan Lundell wrote: > On 7 Nov 2013, at 6:00 AM, Anthony > > wrote: > > Actually, my original explanation wasn't quite correct -- I made the > corrections in the original post (same conclusion though -- #2 should be > preferred, but they shou

Re: [web2py] Re: Difference between datetime.now and datetime.now()

2013-11-07 Thread Jonathan Lundell
On 7 Nov 2013, at 6:00 AM, Anthony wrote: > Actually, my original explanation wasn't quite correct -- I made the > corrections in the original post (same conclusion though -- #2 should be > preferred, but they should both result in nearly the same value). I don't see > how using datetime.now w

[web2py] Installing the jqmobile plugin

2013-11-07 Thread Philip Kilner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi All, I'm having problems getting this working! My steps: - - - Create new app. - - Go to admin at /admin/default/site - - From admin, hit the "Try the mobile interface" link. - - Download the plugin from the link in the text on the right. - - Go t

[web2py] Re: Difference between datetime.now and datetime.now()

2013-11-07 Thread Anthony
Actually, my original explanation wasn't quite correct -- I made the corrections in the original post (same conclusion though -- #2 should be preferred, but they should both result in nearly the same value). I don't see how using datetime.now would lead to the error you are getting, but go ahea

[web2py] Re: Difference between datetime.now and datetime.now()

2013-11-07 Thread at
Thanks Anthony for the explanation. We am using #1 and occasionally get '*insufficient data left in message*', could it be because of datetime.now? On Thursday, 7 November 2013 17:56:47 UTC+5, Anthony wrote: > > Is there any difference between following two statements: >> #1 >> from datetime imp

[web2py] Re: Loaded SQLForm.grid file upload fails

2013-11-07 Thread Simon Ashley
Thanks Niphlod -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" g

Re: [web2py] Re: Databases folder and the files

2013-11-07 Thread Niphlod
no, unless you do a backup of your files, set fake_migrate=True and check sql.log. On Thursday, November 7, 2013 8:36:47 AM UTC+1, Jayadevan M wrote: > > OK, so I got it wrong. > I see the actual SQLs and execution output in sql.log. The SQLs which are > 'about to be executed' to get the instan

[web2py] Re: Scheduler - a second try

2013-11-07 Thread Andrew W
herbou1 is a function in my isi-controller. Shouldn't this function be in your models? A question for you: how did you turn on debugging for the scheduler? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://cod

[web2py] Re: Scheduler documentation question

2013-11-07 Thread Niphlod
that if you have multiple workers you can have them assigned a "multiple" fraction of the work if you know that they'll process tasks faster. i.e. you have a local worker fetching from the interwebs big chunks of data. You observe that you're queueing tasks faster than that server can process th

[web2py] Re: Scheduler - a second try

2013-11-07 Thread Niphlod
what db are you using ? On Thursday, November 7, 2013 12:07:40 PM UTC+1, Johann Spies wrote: > > It was a year ago that I have tried for 4 days to get the scheduler > working. In the end I gave up and decided to use the operating systems's > cron to handle scheduled jobs. > > I am trying again

[web2py] Re: Loaded SQLForm.grid file upload fails

2013-11-07 Thread Niphlod
it's a known and documented behaviour http://web2py.com/books/default/chapter/29/12/components-and-plugins?search=multipart Basically, you can't upload a file via ajax via jquery unless some major "refactorings"/"adoption of other libraries"/"all browsers with a common api" will support it. --

[web2py] Re: Difference between datetime.now and datetime.now()

2013-11-07 Thread Anthony
> > Is there any difference between following two statements: > #1 > from datetime import datetime > db.my_table.insert(updated=datetime.now) > > and > #2 > from datetime import datetime > db.my_table.insert(updated=datetime.now()) > I believe they should result in (almost) the same entry into t

[web2py] Loaded SQLForm.grid file upload fails

2013-11-07 Thread Simon Ashley
Have an issue where files can't be uploaded via a SQLFORM.grid form that is loaded/ called via ajax. The update/ create write to the table fails. If a file isn't selected, and other fields are updated, the write is successful. A non ajax called form works OK. The error message following a fa

Re: [web2py] Difference between datetime.now and datetime.now()

2013-11-07 Thread Vasile Ermicioi
datetime.now is a function datetime.now() is the result of the function request.now is equal to datetime.now() On Thu, Nov 7, 2013 at 12:32 PM, at wrote: > > Hi, > > Is there any difference between following two statements: > #1 > from datetime import datetime > db.my_table.insert(updated=date

[web2py] Re: Module import problem ----> (No module named modules)

2013-11-07 Thread floydpetrus
Den onsdagen den 6:e november 2013 kl. 23:45:24 UTC+1 skrev Cliff Kachinske: > > Do you have __init__.py in your modules folder? > > On Wednesday, November 6, 2013 2:36:16 PM UTC-5, Niphlod wrote: >> >> posting what you're trying to import may help us to figure out the cause >> and give a soluti

Re: [web2py] Re: Web2py freezing on live deployment!

2013-11-07 Thread Andrew Buchan
Thanks for the suggestions, gevent looks good but I am indeed using pyodbc and this seems to be working with Apache so I'd rather stick with this for time being. (Note I had to embedd the Python27.dll manifest into pyodbc.pyd to get it to work with Apache). The reason for using ajax in the first p

[web2py] Scheduler - a second try

2013-11-07 Thread Johann Spies
It was a year ago that I have tried for 4 days to get the scheduler working. In the end I gave up and decided to use the operating systems's cron to handle scheduled jobs. I am trying again and so far I have no success. Running web2py with D0 I get the message DEBUG:web2py.scheduler.artikel#29

[web2py] Difference between datetime.now and datetime.now()

2013-11-07 Thread at
Hi, Is there any difference between following two statements: #1 from datetime import datetime db.my_table.insert(updated=datetime.now) and #2 from datetime import datetime db.my_table.insert(updated=datetime.now()) where, db.define_table('my_table', Field('updated', type='datetime', defau

[web2py] R/W restrictions specific to a form

2013-11-07 Thread subbaraman . kiran
Hello All, I have these two tables db.auth_user - which is the default table created for Auth email, password, first name, last name db.b b0, b1, b2, b3 db.b.b0 foreign-key linked to db.auth_user.id My requirement: Display only fields first name, last name, b2, b3. Updates can only happen to t

[web2py] Scheduler documentation question

2013-11-07 Thread Johann Spies
Can somebody please explain to me what this sentence from the book is trying to tell me? "['mygroup','mygroup']. Tasks will be distributed taking into consideration that a worker with group_names ['mygroup','mygroup'] is able to process the double of the tasks a worker with group_names ['mygroup']