[web2py] Re: ValueError: need more than 1 value to unpack

2011-11-22 Thread Rahul
What's inside now? Inside now contains this - import datetime; now = datetime.datetime.now() # For date time Vinicius, I am sorry about the messed up traceback - Never noticed that. simply copy-pasted the same. will take care in future (for now its pasted below again) But I don't understand why

[web2py] Attaching a file to a mail

2011-11-22 Thread Kenneth Lundström
Hello, in our web2py based billing application we generate PDF:s that are sent to customers. So far I have always saved the PDF onto my local computer and attached that to a mail. Now I'd like to develop the app so I could send the bill directly from the app. When the PDF is created it is

[web2py] Re: Problem with using .as_list()

2011-11-22 Thread villas
Oops, when I was testing it, I thought I could do this: fields = (db.test.id,db.test.ref,db.test.descr) db(db.test.id0).select(fields).as_list() It seems that I have to do this: db(db.test.id0).select(db.test.id,db.test.ref,db.test.descr).as_list() Sorry for confusion!

Re: [web2py] Attaching a file to a mail

2011-11-22 Thread Massimiliano
remove response.headers['Content-**Type']='application/pdf' f.render(filename, dest='F') Ciao 2011/11/22 Kenneth Lundström kenneth.t.lundst...@gmail.com Hello, in our web2py based billing application we generate PDF:s that are sent to customers. So far I have always saved the PDF onto my

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-22 Thread villas
#This uses 'links' to display my virtual field 'extradate'... #Shows grid with all fields grid=SQLFORM.grid(query=(db.prop.id 10), links=[dict(header='ExtraDate', body=lambda row: row.extradate)] ) #This does the same thing but specifies fields... grid=SQLFORM.grid(query=(db.prop.id 10),

Re: [web2py] Re: ValueError: need more than 1 value to unpack

2011-11-22 Thread Vinicius Assef
Rahul, some thoughts: 1) Your define_table() is executed at model time. When do you adjust now contents? 2) I had this problem some time ago. The situation was I had created my date field after some data was inserted in my table. So, this error happened when I tried to retrieve some old data. I

Re: [web2py] Attaching a file to a mail

2011-11-22 Thread Kenneth Lundström
Thank You. Works great now. Kenneth remove response.headers['Content-Type']='application/pdf' f.render(filename, dest='F') Ciao 2011/11/22 Kenneth Lundström kenneth.t.lundst...@gmail.com mailto:kenneth.t.lundst...@gmail.com Hello, in our web2py based billing application we

[web2py] Re: web2py and FirePHP

2011-11-22 Thread Ed Greenberg
Tried again. The link to www.box.com is definitely returning 404. If you see content there, related to web2py, could you help me retrieve it? Thanks, Ed On Nov 20, 11:04 pm, Vineet vineet.deod...@gmail.com wrote: I can access that link. You may try to hit the link again. --- Vineet On Nov

Re: [web2py] Re: Problem with using .as_list()

2011-11-22 Thread Manuele
On 22/11/2011 11:58, villas wrote: fields = (db.test.id,db.test.ref,db.test.descr) db(db.test.id0).select(fields).as_list() It seems that I have to do this: db(db.test.id0).select(db.test.id,db.test.ref,db.test.descr).as_list() or if you prefer: fields = [db.test.id, db.test.ref,

[web2py] Re: Webfaction: Memory usage way over your limit ; again.

2011-11-22 Thread Plumo
very useful information - thanks Robert. I got compile errors for nginx - tried multiple versions and only 0.9.6.5 built, which doesn't support --http-socket. I am on web9 which I understand is one of the older servers: http://community.webfaction.com/questions/3042/uwsgi-installation Which

Re: [web2py] Re: Webfaction: Memory usage way over your limit ; again.

2011-11-22 Thread Roberto De Ioris
Il giorno 22/nov/2011, alle ore 14:19, Plumo ha scritto: very useful information - thanks Robert. I got compile errors for nginx - tried multiple versions and only 0.9.6.5 built, which doesn't support --http-socket. I am on web9 which I understand is one of the older servers:

[web2py] Re: import_from_csv_file problem with reference fields with 1.99.2?

2011-11-22 Thread Zphen
I'm interested to learn the answer to this -I tried to export from SQLite and import into a MySQL database, but the references got messed up no matter what I tried... On Nov 22, 4:36 am, David Manns dgma...@gmail.com wrote: In my application which is hosted on GAE I have backup/restore

[web2py] Formatting numbers in SQLFORM grid

2011-11-22 Thread Freerk Kalsbeek
Hi, I'm trying to format numbers according to the dutch standard (decimal comma separator). It is working on view/edit views by adding: requires=IS_DECIMAL_IN_RANGE(0,100,dot=',') to the numeric field. But in list views the numbers are displayed with a decimal dot. How can I change that?

[web2py] Tornado issues

2011-11-22 Thread sree
Hi All, I am working with the python package SocketTornadIO and socketio for realtime polling on web2py. The issue I am facing is that if there is an established connection and some process is on (eg.read a file and send the data to client) ; I cannot establish a connection till the first

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-22 Thread Anthony
Massimo, the issue is that the grid doesn't provide an easy way to include virtual fields. You can do it by using the 'links' argument with a dictionary for each virtual field (though that's a bit cumbersome), but then you cannot use the 'fields' argument to select only a subset of fields or

[web2py] basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
Hello, In our project we need to create a temporary user for the web2py app so that a remote system can send back a singe status update. In order to do this, when the command is sent out we create a temporary user like this: settings[serverUser] = str(uuid.uuid4())

[web2py] Re: Formatting numbers in SQLFORM grid

2011-11-22 Thread Massimo Di Pierro
Can you provide an example? Wat do you mean in list view? On Nov 22, 6:41 am, Freerk Kalsbeek fre...@mindswitch.net wrote: Hi, I'm trying to format numbers according to the dutch standard (decimal comma separator). It is working on view/edit views by adding:

[web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Massimo Di Pierro
must be hashed settings[serverPassword] = db.auth_user.password.validate(str(uuid.uuid4()))[0] On Nov 22, 8:19 am, Matt Broadstone mbroa...@gmail.com wrote: Hello, In our project we need to create a temporary user for the web2py app so that a remote system can send back a singe status update.

[web2py] Re: Insert references in a record

2011-11-22 Thread Anthony
On Tuesday, November 22, 2011 12:30:42 AM UTC-5, Adrian Edwards wrote: form = SQLFORM(db.entries) form.date_entered = date.today() form.user = user if form.process().accepted: But the form won't submit. When I debug it through Eclipse it says lazyT: value not in database I

[web2py] Re: ValueError: need more than 1 value to unpack

2011-11-22 Thread Massimo Di Pierro
        form.vars.updated_on= now what's now?         form.vars.posted_by = Rahul posted_by must be an id. On Nov 22, 3:21 am, Rahul rahul.dhak...@gmail.com wrote: What's inside now? Inside now contains this - import datetime; now = datetime.datetime.now() # For date time Vinicius, I am

[web2py] tutorial on creating jquery plugins

2011-11-22 Thread Massimo Di Pierro
http://www.re-cycledair.com/creating-jquery-plugins

Re: [web2py] Re: Problem with using .as_list()

2011-11-22 Thread villas
Thanks Manuele, that's the shortcut I should have been using. D

[web2py] GAE Caching and Views

2011-11-22 Thread johntynan
I am using the following decorator: @cache(request.env.path_info, time_expire=5, cache_model=cache.ram) To cache some db queries, however, when I go to deploy this on Google App Engine, I receive a PicklingError: Can't pickle type 'function': attribute lookup __builtin__.function failed You can

[web2py] Re: GAE Caching and Views

2011-11-22 Thread Anthony
How about: return response.render(dict(pledges=pledges)) An alternative is just to cache the select instead of the whole view: pledges=db((db.pledge.segment==segment_id) (db.pledge.read == False)).select(orderby=~db.pledge.created_on, cache=(cache.ram, 5)) In that case, you would

[web2py] All fields stored as uppercase

2011-11-22 Thread Vinicius Assef
Hi guys, my customer wants all data typed in forms, be stored in uppercase letters. What's the best way to achieve it, with little effort? -- Vinicius Assef.

[web2py] Re: Ajax and table rows.

2011-11-22 Thread Cliff
signature from book: IS_IN_DB(db, 'person.id', '%(name)s', zero=T('choose one')) can also be: IS_IN_DB(db(query), 'person.id', '%(name)s', zero=T('choose one')) You have: IS_IN_DB(db(db.categories.parent_table==request.args(0)),'categories.id','c ategories.name') Should be:

[web2py] Re: web2py and FirePHP

2011-11-22 Thread ron_m
I just tried, no problem. Are you behind a proxy?

[web2py] transfer auth_group data with the app

2011-11-22 Thread petrasadi
In my auth_group data I have defined a 'manager' role. The problem is that when I try to deploy my app, the db does not get transferred, so my code breaks because the 'manager' group cannot be found. Is there a way to have it initialized when the app installs in a new location? Thank you

[web2py] Re: Insert references in a record

2011-11-22 Thread Adrian Edwards
Thanks for the feedback. I have been making progress but not quit there. Massimo - I did find some logic problems with my initial select that were contributing to the problem. Anthony - I do think that how the form is being populated is part of the problem I've been trying to build this

[web2py] Re: All fields stored as uppercase

2011-11-22 Thread Anthony
I suppose you could use the IS_UPPER() validator on all the fields -- that will convert all input to upper case for storage in DB. You could also use JS/jQuery on the client side to convert as the user types. Anthony On Tuesday, November 22, 2011 10:48:10 AM UTC-5, viniciusban wrote: Hi

[web2py] Re: Insert references in a record

2011-11-22 Thread Anthony
On Tuesday, November 22, 2011 11:31:21 AM UTC-5, Adrian Edwards wrote: form = SQLFORM(db.entries) form.vars.date_entered = date.today() form.vars probably needs a string representation instead of a date object. Instead, maybe set the field's default value:

[web2py] Re: web2py and FirePHP

2011-11-22 Thread LightDot
I can't see it either. Oops — this shared file or folder link has been removed No proxies whatsoever. Odd... Perhaps someone could post it on another file sharing service and provide a link?

[web2py] Re: transfer auth_group data with the app

2011-11-22 Thread Massimo Di Pierro
how about create a models/startup.py def startupcode(): db.commit() import os os.rename(os.path.join(request.folder,'models','startup.py'), os.path.join(request.folder,'private','startup.py')) startupcode() On Nov 22, 10:08 am, petrasadi petras...@gmail.com wrote: In

[web2py] Re: Insert references in a record

2011-11-22 Thread Adrian Edwards
I thought the same thing and so made date_entered capable of being empty and removed it from the form. Same result But I did find a hack workaround and it makes me wonder if my problem has to do with the user field being a foreign key and SQLFORM not liking that its empty (since I populate just

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
On Tue, Nov 22, 2011 at 9:21 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: must be hashed Hmm I can't seem to get this working. I should probably have mentioned that we are using basic auth to use this user on the client side. When I hash the password and insert it into the database it

Re: [web2py] Easy handling of subforms

2011-11-22 Thread Richard Vézina
I think we need Massimo opinion on this... Richard On Thu, Nov 17, 2011 at 12:16 PM, ~redShadow~ redsha...@hackzine.orgwrote: On Wed, 2011-11-16 at 15:36 -0500, Richard Vézina wrote: Man! I think you got a nice solution for this exact problem... I had tried with jQuery in the

[web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Massimo Di Pierro
If the password is a UUID how are the users supposed to know what it and use it to login. I am missing something here. On Nov 22, 12:08 pm, Matt Broadstone mbroa...@gmail.com wrote: On Tue, Nov 22, 2011 at 9:21 AM, Massimo Di Pierromassimo.dipie...@gmail.com wrote: must be hashed Hmm I

[web2py] starting web2py with uwsgi problem.

2011-11-22 Thread peter
I have a linux server (centos) When I set up my remote server, it works fine with the rocket server. However when I use uwsgi, it starts as a different user to root, and root is the owner of the web2py directories. So web2py does not work because it cannot write to the directories. Does anyone

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
On Tue, Nov 22, 2011 at 1:32 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: If the password is a UUID how are the users supposed to know what it and use it to login. I am missing something here. its a temporary password, for a one time callback. On Nov 22, 12:08 pm, Matt Broadstone

[web2py] Modules in modules folder don't reload

2011-11-22 Thread Vinicius Assef
I lost some time this afternoon fighting against a bug that was already solved, but I didn't see it working. I'm importing a python module in myapp/modules folder. Changes I made there wasn't saw in browser processing. The only way to make it work was restarting web2py server. Is there any

[web2py] mail.send bug?

2011-11-22 Thread Tito Garrido
Hi Folks! I'm using the latest stable version of web2py and I was trying mail.send + 'logging' to test some emails... This is what I got: mail.send(to='m...@email.com') and this is what I get on my console: WARNING:web2py:email not sent From:

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
On Tue, Nov 22, 2011 at 2:31 PM, Matt Broadstone mbroa...@gmail.com wrote: On Tue, Nov 22, 2011 at 1:32 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: If the password is a UUID how are the users supposed to know what it and use it to login. I am missing something here. its a

[web2py] Can't load gaehandler

2011-11-22 Thread Ussabin
I'm trying to access a new webapp that I've deployed to a new GAE Python Dev Web Server. When I hit the default URL (http://localhost: 8080) I get the following error: dev_appserver.py:1069] Encountered error loading module gaehandler I'm using the example app.yaml that came with my

[web2py] Web2py on pypy 1.7

2011-11-22 Thread Angelo Compagnucci
It give this error: Traceback (most recent call last): File /home/angelo/DEV/web2py-dev/gluon/main.py, line 493, in wsgibase serve_controller(request, response, session) File /home/angelo/DEV/web2py-dev/gluon/main.py, line 187, in serve_controller environment =

[web2py] Re: transfer auth_group data with the app

2011-11-22 Thread petrasadi
thank you for this, but I have one more question: is this guarantied to execute only once (upon installation).

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Anthony
On Tuesday, November 22, 2011 3:00:46 PM UTC-5, Matt wrote: Aren't passwords always hashed when entered in the database? Not necessarily. You have to have the CRYPT() validator on the password field for hashing. It is there by default, but is not required and could be removed. Anthony

[web2py] Re: Modules in modules folder don't reload

2011-11-22 Thread Anthony
In Python, imported modules don't reload automatically. In web2py, you can tell it to reload whenever there is a change by adding the following: from gluon.custom_import import track_changes track_changes(True) See

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
On Tue, Nov 22, 2011 at 3:50 PM, Anthony abasta...@gmail.com wrote: On Tuesday, November 22, 2011 3:00:46 PM UTC-5, Matt wrote: Aren't passwords always hashed when entered in the database? Not necessarily. You have to have the CRYPT() validator on the password field for hashing. It is there

Re: [web2py] starting web2py with uwsgi problem.

2011-11-22 Thread Kenneth Lundström
Hi Peter, I'm using Apache and WSGI but this should work the same. I always run chown apache:web2py -R on an new application folder. Apache is the user that Apache is running as and web2py is the user (and group) that WSGI is running as. It is never good to run anything as root. Kenneth

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Anthony
I haven't been following the discussion. Do you want to remove the CRYPT validator? If so, I think something like: db.auth_user.password.requires = None Anthony On Tuesday, November 22, 2011 3:57:18 PM UTC-5, Matt wrote: On Tue, Nov 22, 2011 at 3:50 PM, Anthony abas...@gmail.com wrote: On

[web2py] Form design question

2011-11-22 Thread Adrian Edwards
Hello again, This time I have a form design question. I have a view who's content is date dependent where if date.today() is in-between start_date and end_date then a SQLFORM is displayed. Otherwise display a custom message, i.e. Time has expired. In my first solution I added the logic in the

[web2py] Re: Can't load gaehandler

2011-11-22 Thread howesc
hmmm, that's odd. try re-downloading web2py? either way, gaehandler is here: http://code.google.com/p/web2py/source/browse/gaehandler.py (note that is the trunk version which may or may not match the latest released version. cfh

[web2py] Re: GAE Caching and Views

2011-11-22 Thread howesc
actually, unless something changed on on GAE, select caching does not work because the rows object is not picklable. the @cache decorator caches the dict that you return to the view, not the rendered view. if something in that dict is not picklable (say a rows object) the cache will fail.

[web2py] Re: mail.send bug?

2011-11-22 Thread Niphlod
That bug has been fixed in trunk. It's only the 'logging' visualization that was wrong, don't worry... On 22 Nov, 20:54, Tito Garrido titogarr...@gmail.com wrote: Hi Folks! I'm using the latest stable version of web2py and I was trying mail.send + 'logging' to test some emails... This is

[web2py] Re: Computed Fields not updating

2011-11-22 Thread Richard G
I have run into the above as well. Likely the issue is that on update you are not returning all values that the 'compute' field is based upon. Ex: db.define_table('test', Field('val1', 'double'), Field('val2', 'double'), Field('result', compute = lambda r: r['val1'] + r['val2']) )

[web2py] Re: Form design question

2011-11-22 Thread Cliff
One way to do it. There are others I'm certain... Controller if time_in_range: form = SQLFORM( if something_else: form = 'something else' # or any expression you like if another_thing: form = 'another thing' return dict(form=form) If you want to use different views, check

[web2py] Re: Form design question

2011-11-22 Thread Adrian Edwards
Thanks Cliff. I like your suggestion better. Now I can simply have the view check if type(form) is SQLFORM): display form else: ...display message On Nov 22, 5:05 pm, Cliff cjk...@gmail.com wrote: One way to do it.  There are others I'm certain... Controller if time_in_range:     form

[web2py] Re: Computed Fields not updating

2011-11-22 Thread Richard G
I should mention that I don't really use CRUD. So I've assumed the above scenario is the same as using CRUD / sqlform.smartgrid. Also, you may want to look into Virtual Fields if you don't need to actually store the data. These are computed upon retrieval of records, not insertion / updates.

[web2py] Re: transfer auth_group data with the app

2011-11-22 Thread Massimo Di Pierro
yes because the file gets moved in a different folder after execution. It is a bit of a hack. We should think of a better way On Nov 22, 2:41 pm, petrasadi petras...@gmail.com wrote: thank you for this, but I have one more question: is this guarantied to execute only once (upon installation).

[web2py] Re: GAE Caching and Views

2011-11-22 Thread Massimo Di Pierro
select(cache) does not serielizes Rows but the dictionary returned by the select. I have never tried it on GAE. For sure you cannot cache in run but it should be possible to cache.memcache. If that does not work it is because the datastore returns a type that is not serializible. On Nov 22, 3:26 

[web2py] Re: transfer auth_group data with the app

2011-11-22 Thread Limedrop
Massimo's solution sure is cunning, but you might something like this a bit more maintainable: def install(): if db(db.auth_group.id 0).count() == 0: db.auth_group.insert(role = 'edit') db.auth_group.insert(role = 'moderate') db.auth_group.insert(role = 'comment')

[web2py] Re: Form design question

2011-11-22 Thread Cliff
You can simplify the view further if you always return something named form. I'm biased in favor putting as much logic as possible in the models controllers. On Nov 22, 5:09 pm, Adrian Edwards aedward...@gmail.com wrote: Thanks Cliff. I like your suggestion better. Now I can simply have the

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
On Tue, Nov 22, 2011 at 4:11 PM, Anthony abasta...@gmail.com wrote: I haven't been following the discussion. Do you want to remove the CRYPT validator? If so, I think something like: db.auth_user.password.requires = None This seems to have fixed the issue, thank you both Matt Anthony On

[web2py] Re: ERROR:Rocket.Errors.Port8000:SSL Error: [Errno 8] _ssl.c:499: EOF occurred in violation of protocol on Upgraded v1.99.1

2011-11-22 Thread Matt
On Nov 21, 6:42 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Please try the nightly build and let me know. I didn't check out the whole nightly build, but just replaced rocket.py and that seems to have fixed it. Matt On Nov 21, 10:07 am, Matt mbroa...@gmail.com wrote: On

[web2py] Re: transfer auth_group data with the app

2011-11-22 Thread Anthony
Though that will do an unnecessary db query on every request after the install. Anyway, you can do: if db.auth_group.isempty(): Anthony On Tuesday, November 22, 2011 6:59:58 PM UTC-5, Limedrop wrote: Massimo's solution sure is cunning, but you might something like this a bit more

[web2py] Re: Form design question

2011-11-22 Thread Adrian Edwards
I think that makes sense, putting the logic in the controllers. Thanks for the feedback. On Nov 22, 7:38 pm, Cliff cjk...@gmail.com wrote: You can simplify the view further if you always return something named form. I'm biased in favor putting as much logic as possible in the models

[web2py] Re: starting web2py with uwsgi problem.

2011-11-22 Thread pbreit
Why not set ownership of web2py files to whatever uwsgi is expecting?

Re: [web2py] Web2py on pypy 1.7

2011-11-22 Thread Bruno Rocha
There is a ticket about this http://code.google.com/p/web2py/issues/detail?id=464 You can remove this line and everything still works normally. On Tue, Nov 22, 2011 at 6:34 PM, Angelo Compagnucci angelo.compagnu...@gmail.com wrote: It give this error: Traceback (most recent call last):

[web2py] Re: Web2py on pypy 1.7

2011-11-22 Thread Massimo Di Pierro
I missed yor response. I will remove the line. On Nov 22, 10:00 pm, Bruno Rocha rochacbr...@gmail.com wrote: There is a ticket about thishttp://code.google.com/p/web2py/issues/detail?id=464 You can remove this line and everything still works normally. On Tue, Nov 22, 2011 at 6:34 PM,

[web2py] Re: web2py and FirePHP

2011-11-22 Thread ron_m
Ed, Sorry, I looked at the URL in your second message www.box.com and that works. The URL in your first message to a specific shared file gives me a 404 response too. This is a file sharing site like dropbox so it appears the file owner has removed it. I tried a few of the web page archives