Re: [web2py] Re: timeit and function

2012-01-03 Thread Martin Weissenboeck
That's it - thank you! 2012/1/3 Alan Etkin > I tried the code but changed the import path with this: > > from applications..modules.mymodule import ff > > This way the action works. I don't like the fact that the actual app > name has to be passed anyway. A workaround would to use interpolation

Re: [web2py] Re: Custom registration action

2012-01-03 Thread Tsvi Mostovicz
Thanks. It simplifies a lot of my current flow. By the way, how am I supposed to finish the function? Just a return statement? Or redirect? Or could I just leave it empty? Meaning: def register_onvalidation(): command1 command2 (Do I need here a return statement?) Thanks, Tsvi

[web2py]

2012-01-03 Thread acculon
Receive Notifications of Incoming Messages Easily monitor multiple email accounts & access them with a click. Visit www.inbox.com/notifier and check it out!

Re: [web2py] Re: web2py application to run linux command

2012-01-03 Thread steve van christie
thank you so much for your hint, massimo, but, i'm still confused about it, is there any documentation for that? i plan to make a form field for the parameter, and then after submit, it will execute the linux command. On Wed, Jan 4, 2012 at 10:33 AM, Massimo Di Pierro < massimo.dipie...@gmail.com>

[web2py] Re: web2py application to run linux command

2012-01-03 Thread Massimo Di Pierro
os.system("ls -l > ls.log") or better subprocess.Popen() which allows to start a process in one request, leave it running, capture the stdout and retrieve it later in a different http request. Look how applications/admin/gae.py handles the GAE sdk On Jan 3, 9:04 pm, 黄祥 wrote: > hi, > > is i

[web2py] web2py application to run linux command

2012-01-03 Thread 黄祥
hi, is it possbile to make web2py application to run linux command? i want to make a web application like cobbler web, web bacula base on web2py. thank you very much before

[web2py] Re: Soliciting freelance developers

2012-01-03 Thread Anthony
http://experts4solutions.com/ http://www.web2py.com/examples/default/support

[web2py] Soliciting freelance developers

2012-01-03 Thread web-dev-m
I am developing an application, and I love web2py. I am new to programming, and I have gotten quite far on limited expertise. However, I reached a point where I am going to need help to finish my application. Anyone have experience with sites like guru.com to hire a freelance developer to help wi

[web2py] Re: How can I access HTTP Headers?

2012-01-03 Thread Anthony
Note, web2py Ajax components send some custom headers (web2py-component-element and web2py-component-location), so if custom headers aren't getting through in a particular configuration, I suppose Ajax components won't work properly either. Let us know what you find out. Anthony On Tuesday, Ja

Re: [web2py] can't get compute to work on update

2012-01-03 Thread Richard Vézina
I think I am making something that make web2py confuse... Here one of my lamdba : lambda row : '%s%s%s%s-%02d%05d' %(str(db.ref_product_code(int(row['product_code_id'])).product_code_code),str((db.ref_process(int(row['process_id'])).process_letter_code)),str(db.ref_production_site(int(row['site_i

Re: [web2py] can't get compute to work on update

2012-01-03 Thread Richard Vézina
Hello Richard, Do you means those lines : for ofield in self: if not ofield.name in new_fields_names and ofield.compute: #try: new_fields.append((ofield,ofield.compute(Row(fields #except KeyError: #pass A

[web2py] Re: smartgrid duplicate rows in many-to-many link table - how to avoid?

2012-01-03 Thread Cliff
Case closed. After doing something else all day, the answer came to me ... Change the controller to this: # find the id of dogs, if any, that already belong to the owner rows = db(db.dog_owner.owner_id==request.args[-3]).select( db.dog_owner.dog_id ) # if t

[web2py] How to implement http_user_agents statistics?

2012-01-03 Thread thstart
I am recording http_user_agents info like this: *value:* [u'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)', u'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7', u'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1;

[web2py] Re: How can I access HTTP Headers?

2012-01-03 Thread James M.
Good to know that it is working with apache. Thanks for your help. On Jan 3, 2:26 pm, Anthony wrote: > Actually, just tried sending a hurl.it request, and Apache with mod_wsgi > did pass the custom header to web2py, so maybe your problem is with your > nginx setup. > > Anthony > > > > > > > > On

Re: [web2py] can't get compute to work on update

2012-01-03 Thread Richard Vézina
Thanks! I do that... Richard On Tue, Jan 3, 2012 at 5:12 PM, Richard Galka wrote: > A quick and dirty way to check what is going on is to add debug > statements in the web2py dal.py code. > > I had a similiar issue, and the quickest way I found to check why compute > failed was to remove the "e

[web2py] Re: How can I access HTTP Headers?

2012-01-03 Thread Anthony
Actually, just tried sending a hurl.it request, and Apache with mod_wsgi did pass the custom header to web2py, so maybe your problem is with your nginx setup. Anthony On Tuesday, January 3, 2012 5:17:52 PM UTC-5, Anthony wrote: > > Sorry, not enough sleep last night. Anyway, I have been able to

[web2py] Re: timeit and function

2012-01-03 Thread Alan Etkin
I tried the code but changed the import path with this: from applications..modules.mymodule import ff This way the action works. I don't like the fact that the actual app name has to be passed anyway. A workaround would to use interpolation and the request.application variable. Still, i don't fi

[web2py] Re: How can I access HTTP Headers?

2012-01-03 Thread Anthony
Sorry, not enough sleep last night. Anyway, I have been able to pick up custom headers when running Rocket and Apache with mod_wsgi, so it should work in general. I'm not sure what the problem is in this case. Have you tried actual requests from Twilio (rather than just testing with hurl.it)? A

Re: [web2py] can't get compute to work on update

2012-01-03 Thread Richard Galka
A quick and dirty way to check what is going on is to add debug statements in the web2py dal.py code. I had a similiar issue, and the quickest way I found to check why compute failed was to remove the "except KeyError" in the "def _lisitfy" of dal.py. Then an error is thrown whenever the comp

Re: [web2py] can't get compute to work on update

2012-01-03 Thread Richard Vézina
As a work around I use onvalidation= and compute my field "manually"... Richard On Tue, Jan 3, 2012 at 4:46 PM, Richard Vézina wrote: > Everything is made in the same controller... I had move everything into > model too... I am really mystified! I have no idea why is my computed field > won't c

[web2py] Re: How can I access HTTP Headers?

2012-01-03 Thread James M.
I think you are looking at the post from IE to http://hurl.it, which is including the Header parameter (as a post parameter) to hurl.it, when it arrives at hurl.it it should create a http post from the hurl.it server to the url specified with header, parameters and body specified. On Jan 3, 10:01 

Re: [web2py] postgres schema

2012-01-03 Thread Richard Galka
In general we use schemas to segregate data and provide access control within web2py. (Authentication and access control is at the DB level and not the web app level). As mentioned by Manuele we also use executesql to set the search path as required. In our environment each schema may provid

Re: [web2py] can't get compute to work on update

2012-01-03 Thread Richard Vézina
Everything is made in the same controller... I had move everything into model too... I am really mystified! I have no idea why is my computed field won't compute on update. It seems to have all the fields needed and the proper type... Is there a way to get Row object passing by the form when accep

Re: [web2py] Re: Reading lines from uploaded SQLFORM.factory file

2012-01-03 Thread Jim Steil
Created ticket: http://code.google.com/p/web2py/issues/detail?id=597 On 1/3/2012 2:40 PM, Anthony wrote: On Tuesday, January 3, 2012 2:58:30 PM UTC-5, Jim S wrote: Should I submit a ticket on it, or is this email exchange enough to get it fixed in the book? What are your thought

Re: [web2py] can't get compute to work on update

2012-01-03 Thread howesc
if the compute is defined (and attached to the field) in the same controller as the update is being called it should be fine. if the compute is defined in a different controller there might be problems.

[web2py] Re: Web2Py Blob Upload/Download Samples for GAE?

2012-01-03 Thread howesc
also see: http://www.web2pyslices.com/slices/take_slice/63 for blobstore usage. cfh

[web2py] book improvement

2012-01-03 Thread Richard
Hello, In chapter 6, "Computed field" section, the following sentence could be clearer if splitted and reformulated : When a new record is modified, including both insertions and updates, if a value for the field is not provided, web2py tries to compute from the other field values using the compu

Re: [web2py] Re: Reading lines from uploaded SQLFORM.factory file

2012-01-03 Thread Anthony
On Tuesday, January 3, 2012 2:58:30 PM UTC-5, Jim S wrote: > > Should I submit a ticket on it, or is this email exchange enough to get > it fixed in the book? > > What are your thoughts on the bogus directory name being allowed and then > blindly not saving the file? Seems to me that this could

Re: [web2py] Re: Reading lines from uploaded SQLFORM.factory file

2012-01-03 Thread Jim Steil
Should I submit a ticket on it, or is this email exchange enough to get it fixed in the book? What are your thoughts on the bogus directory name being allowed and then blindly not saving the file? Seems to me that this could be an issue as well. -Jim On 1/3/2012 1:42 PM, Anthony wrote:

[web2py] can't get compute to work on update

2012-01-03 Thread Richard
Hello, I have problem with compute field that won't compute on update form submission... If I look into form.vars all the data needed by the compute lambda function... I define the compute field lambda on the fly at controller level could it cause the problem? Do the compute lambda function get

Re: [web2py] Re: Reading lines from uploaded SQLFORM.factory file

2012-01-03 Thread Anthony
No, I think the book example is incorrect -- you get an error without specifying something for the uploadfolder, so we should fix that. Anthony On Tuesday, January 3, 2012 2:33:26 PM UTC-5, Jim S wrote: > > Sorry, still confused. Is the example in the book incorrect then? > http://web2py.com

Re: [web2py] Re: Reading lines from uploaded SQLFORM.factory file

2012-01-03 Thread Jim Steil
Sorry, still confused. Is the example in the book incorrect then? http://web2py.com/books/default/chapter/29/7#SQLFORM.factory Another thing I noticed is that I can pass any string to uploadfolder and the form will work. If the name passed isn't a valid directory, the form still works but t

Re: [web2py] gluon.storage.Storage - No more KeyError breaks backward compatibility

2012-01-03 Thread Ross Peoples
Bruno is correct, and that's the whole point of Storage is that you don't have to test request.vars, you just call it. Alternatively, you can treat Storage just like any other dict(). For your example, there are many ways to solve the above example: if 'sort' in request.vars: sort = request

[web2py] Re: How can I access HTTP Headers?

2012-01-03 Thread Anthony
On Tuesday, January 3, 2012 12:31:10 PM UTC-5, James M. wrote: > > I am testing it using http://hurl.it and manually adding the header, > so I am fairly confident the header is getting passed(at least in > testing). Hmm, when I try hurl.it in IE and add a custom header, the custom header doesn

Re: [web2py] Re: Reading lines from uploaded SQLFORM.factory file

2012-01-03 Thread Anthony
In DAL.Field.store(), when no uploadfolder is specified with the Field definition, it looks for Field.db._adapter.folder (to get the /app/databases folder). SQLFORM.factory constructs a fake db table via DAL(None).define_table(table_name, *fields), which does not have a db._adapter.folder. Ant

[web2py] Re: How can I access HTTP Headers?

2012-01-03 Thread James M.
I am testing it using http://hurl.it and manually adding the header, so I am fairly confident the header is getting passed(at least in testing). What Massimo suggested, wsgi not passing it, could be the issue. I have a pretty vanilla nginx install on linode. My install pretty much followed this

Re: [web2py] gluon.storage.Storage - No more KeyError breaks backward compatibility

2012-01-03 Thread Bruno Rocha
One good feature of storage object is the 'None' returned instead of KeyError. By the way it does not break backwards compatibility because it is a documented feature[1] "Unlike a dictionary, if an attribute (or key) does not exist, it does not raise an exception. Instead, it returns None." The

[web2py] Re: email/password Login cannot enter longer emails like 30 letters.

2012-01-03 Thread thstart
problem solved - it was in the widget - thank you!

Re: [web2py] IS_IN_SET, multiple=False, checkboxes

2012-01-03 Thread Richard Vézina
I think you should use SQLFORM.widgets.radio.widget for the behavior you would have... Radio button are used when you want only one choice at a time, check box is when you want multiple input... Richard On Tue, Jan 3, 2012 at 11:01 AM, thodoris wrote: > Hello, > > I have come uppon the followin

[web2py] IS_IN_SET, multiple=False, checkboxes

2012-01-03 Thread thodoris
Hello, I have come uppon the following. If i declare the following field Field('test', notnull=True, requires=IS_IN_SET([1,2,3,4],multiple=False),widget=SQLFORM.widgets.checkboxes.widget), The expected behaviour should be to be able to select only one checkbox. What is happening is that i am al

Re: [web2py] Re: timeit and function

2012-01-03 Thread Martin Weissenboeck
Now I have tried: from mymodule import ff def ff2(): return dict(a=ff()) def tm(): import timeit t1 = timeit.Timer(stmt='a=2*3').timeit(number=100)/100 t2 = timeit.Timer(stmt='a=ff()', setup='from mymodule import ff').timeit(number=100)/100 return dict(t1=t1, t2=t2) f

Re: [web2py] Application user interface

2012-01-03 Thread Bruce Wade
I have used Dojo, it is great unless you need to support IE then you will run into some major problems. Like others said jQuery can handle most situations. On Tue, Jan 3, 2012 at 6:44 AM, Richard Vézina wrote: > Also with jQuery it's easy to plug jQurey UI > > Richard > > > On Tue, Jan 3, 2012 a

[web2py] Re: How can I access HTTP Headers?

2012-01-03 Thread Anthony
Can you confirm that the header is being sent? I just mocked up an Ajax request with an 'X-Twilio-Signature' header, and found it in web2py as request.env.http_x_twilio_signature. Try including response.toolbar() in your view (which is included by default in generic.html for local requests) and

Re: [web2py] Re: how to integrate web2py with existing static website

2012-01-03 Thread Richard Baron Penman
I am currently using uwsgi/nginx, and would prefer to stay with that setup because so many others recommended it. I saw some web2py examples here at the uwsgi wiki: http://projects.unbit.it/uwsgi/wiki/Example Does anyone have experience with configuring uwsgi/nginx to just serve web2py for certain

[web2py] gluon.storage.Storage - No more KeyError breaks backward compatibility

2012-01-03 Thread Yarin
Having just upgraded from 1.99.2 to 1.99.4, I noticed that trying to access a gluon.storage.Storage with a missing key no longer returns a KeyError, but None. This broke my application due to the way I check for request vars: try: sort = request.vars['sort'] except KeyError:

Re: [web2py] Application user interface

2012-01-03 Thread Richard Vézina
Also with jQuery it's easy to plug jQurey UI Richard On Tue, Jan 3, 2012 at 9:39 AM, Jim Steil wrote: > Have you looked in to what you can do with jquery? Jquery is included > with the web2py installation. There are also a great number of jquery > addon libraries available assist with the loo

Re: [web2py] Application user interface

2012-01-03 Thread Jim Steil
Have you looked in to what you can do with jquery? Jquery is included with the web2py installation. There are also a great number of jquery addon libraries available assist with the look and feel of your application. I used to use Dojo when I was doing Turbogears development but have been ve

[web2py] Re: How can I access HTTP Headers?

2012-01-03 Thread Massimo Di Pierro
If the header is not is not in request.env than it was never there or wsgi is not passing it along. On Jan 3, 12:57 am, "James M." wrote: > I looked into those two suggestions, the header doesn't seem to be > available. > > I am starting to think that custom headers aren't passed to web2py... > >

Re: [web2py] Re: Reading lines from uploaded SQLFORM.factory file

2012-01-03 Thread Jim Steil
I'm still confused about the uploadfolder. Why do I need to specify it when using SQLFORM.factory but not when using SQLFORM.smartgrid over a table with an 'upload' field. Why doesn't it use the default /uploads folder? Where does the default get set? I'm following the example as in the book

[web2py] Application user interface

2012-01-03 Thread Márcio
Hello, I need to improve the look of my application (not website). It is possible to use DojoToolkit with web2py, or is there some library like best to use? This is too much work? Suggestions?

[web2py] Re: email/password Login cannot enter longer emails like 30 letters.

2012-01-03 Thread Anthony
I don't see anything in the Auth code that would restrict the length of email addresses by default, and I just successfully registered and logged into the current 'welcome' app with thisisaverylongemailaddress @ thisisaverylongdomain.com. Can you provide more detail? Does the input field in the

Re: [web2py] Re: How can I reduce shell memory usage?

2012-01-03 Thread Michael Ellis
Thanks, Massimo. I'll try it and report what happens. Cheers, Mike On Mon, Jan 2, 2012 at 10:38 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > I remind you > > web2py/scripts/make_min_web2py.py > > which makes web2py much smaller by eliminating rarely used module that > consume lo

[web2py] smartgrid duplicate rows in many-to-many link table - how to avoid?

2012-01-03 Thread Cliff
I am trying to keep smartgrid from creating duplicate rows in a linking table, but it isn't working. Here is what I'm trying to do, but it isn't working. Any suggestions? Model: db.define_table('dog', Field('dog_name', length=32), auth.signature, f

Re: [web2py] postgres schema

2012-01-03 Thread Manuele Pesenti
Il 03/01/2012 12:54, Johann Spies ha scritto: I could so far not get that to work. I don't think DAL's design makes provision for that. You should be able to do it outside DAL - using executesql. Regards Johann till I don't work with tables with the same name in different schema I found

[web2py] Re: appadmin when routing domains

2012-01-03 Thread Alan Etkin
I know this is not the best practice, but to avoid that i'd define the first domain unexistent action and use a redirect statement to send the client to the correct address. On 30 dic 2011, 23:52, Plumo wrote: > I am using routers for multiple domains like this: > > routers = dict( >   BASE  = d

[web2py] Re: email/password Login cannot enter longer emails like 30 letters.

2012-01-03 Thread Alan Etkin
Are you seing an error returned by the form processing or the limit is in the web widget? If the case is the second, the email widget may be defining an html input lenght of 30 characters. Then you could customize it with the widget Field parameter. On 3 ene, 05:56, thstart wrote: > I defined ema

[web2py] Re: Custom registration action

2012-01-03 Thread Alan Etkin
If you are using the auth object as configured in the scaffolding app model, it is possible to customize auth with this variables (maybe the list is incomplete): auth.settings.register_onvalidation auth.settings.register_onaccept auth.settings.register_next .._onvalidation is a list of functions

[web2py] Re: timeit and function

2012-01-03 Thread Alan Etkin
I think that there is a problem with importing functions inside controllers "directly". You could place the function in a module (i.e in modules/mymodule.py and do from mymodule import ff) On 3 ene, 05:07, Martin Weissenboeck wrote: > Hi, > I want to measure some times. > > My code: > > def ff():

Re: [web2py] postgres schema

2012-01-03 Thread Johann Spies
On 3 January 2012 12:39, Manuele Pesenti wrote: > Hi *, > is it possible even to work with postgres schemas different than public? > I guess schema are a specific peculiarity of postgres. > > I could so far not get that to work. I don't think DAL's design makes provision for that. You should be

[web2py] Custom registration action

2012-01-03 Thread tsvim
Ok, I changed my code again. Incredible how so many things were though through before. (Multi-tenancy, common_fields, extra_fields in auth, ...) A big thumbs up to all the devs on this. What I'd like to do now is have a custom registration action (not form). I added an extra_field to the auth_us

[web2py] postgres schema

2012-01-03 Thread Manuele Pesenti
Hi *, is it possible even to work with postgres schemas different than public? I guess schema are a specific peculiarity of postgres. thanks Manuele

[web2py] email/password Login cannot enter longer emails like 30 letters.

2012-01-03 Thread thstart
I defined email/password only Login. cannot enter longer emails like 30 letters. I see in auth_user Field('email', length=512, type='string', default='', label=current.T('Email')), What is wrong?

[web2py] Re: migrating to postgres error

2012-01-03 Thread Álvaro J . Iradier
There is also an old thread I started some time ago about quoting identifiers: http://www.mail-archive.com/web2py@googlegroups.com/msg68661.html Greets. On 31 dic 2011, 15:15, Anthony wrote: > On Saturday, December 31, 2011 7:33:30 AM UTC-5, Plumo wrote: > > > ah thanks - that was it. I heard a

[web2py] Re: Cannot get janrain to work

2012-01-03 Thread Tim Olejniczak
Any help is much appreciated, I've been trying to figure this out all day jc writes: > > > I am trying to get janrain login to work in test mode on my development machine. The problem I have is that when I try to execute a controller function for which I have set auth.requires_login(), the sy

Re: [web2py] Re: utf-8 and pyfpdf

2012-01-03 Thread Martin Weissenboeck
Hi José, thank you. "latin-1" code is the answer! 2012/1/2 José Luis Redrejo Rodríguez > Hi Martin, I'm using this in the controller, without any problem: > > > # coding: utf8 > ... >from gluon.contrib.pyfpdf.pdflabels import PDFLabel > >import sys >reload(sys) >sys.setdefaultenc

Re: [web2py] Re: utf-8 and pyfpdf

2012-01-03 Thread Martin Weissenboeck
Thanks, that works! 2012/1/2 Massimiliano > Try this one: > > euro = chr(128) > > as euro char > > > > On Sun, Jan 1, 2012 at 11:29 PM, Martin Weissenboeck > wrote: > >> Now I have found that I have to convert the string: >> >> txt = 'äöü ß ÄÖÜ' >> txt = txt.decode('utf-8').encode('latin-1','re

[web2py] timeit and function

2012-01-03 Thread Martin Weissenboeck
Hi, I want to measure some times. My code: def ff(): return 2*3 def tm(): import timeit t1 = timeit.Timer(stmt='a=2*3').timeit(number=100)/100 t2 = timeit.Timer(stmt='a=ff()',setup='from __main__ import ff').timeit(number=100)/100 return dict(t1=t1, t2=t2) t1 is ok, but t2 g