Re: [web2py] Re: Speeding up IS_IN_DB

2011-01-30 Thread Johann Spies
Maybe this is related - I have not noticed it before: In the terminal from where I started web2py the following appeared: Uncaught RangeError: Maximum call stack size exceeded Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord!

Re: [web2py] Re: Speeding up IS_IN_DB

2011-01-30 Thread Johann Spies
On 28 January 2011 19:54, Massimo Di Pierro wrote: > Something else is wrong. If you have requires=[...] it should not > query the db for the possible references and it should not make the > dropdown. > > Can we see the entire model? > > I have posted the model for this table in an earlier message

[web2py] Re: table field with reference to other in read-only mode doesn't appear right

2011-01-30 Thread szimszon
The error is constant... After the print statement: [(, 'auth'), (, 1), (, 'User 1 Logged-in'), (, datetime.datetime(2011, 1, 31, 7, 43, 21, 687801)), (, '10.1.0.100'), (, 'auth'), (, '')] On jan. 31, 00:18, Massimo Di Pierro wrote: > I cannot reproduce this. Can you help me? > > Can you edit

Re: [web2py] Re: Is Web2py the right choice for me?

2011-01-30 Thread Jason (spot) Brower
Web2py can do all this with a bit of work as shown already. I am curious about your 3d skills as I have been looking for some people to help create a game similar to the old wizardry but using a web-based interface. If you interested in side project like this, drop me a personal email and we can l

Re: [web2py] JSON output errors *hard* to debug

2011-01-30 Thread Jonathan Lundell
On Jan 30, 2011, at 6:38 PM, Art Zemon wrote: > On 01/30/2011 06:50 PM, Jonathan Lundell wrote: >> >> Did you see the "no json" message as well (just curious)? > > Oh yes... and that was what was so distracting. I spent ages trying to figure > out how a simple dict with two elements could be fai

Re: [web2py] JSON output errors *hard* to debug

2011-01-30 Thread Art Zemon
On 01/30/2011 06:50 PM, Jonathan Lundell wrote: Did you see the "no json" message as well (just curious)? Oh yes... and that was what was so distracting. I spent ages trying to figure out how a simple dict with two elements could be failing to create valid JSON. -- Art Z. -- Art Zemon

[web2py] Querying fields with a list record

2011-01-30 Thread rāma
Can't do this anymore in the newer version. Any substitutes? both fields has requires=IS_IN_SET with multiple=True {{=A('('+str(db((~db.pm.deleted_by.contains(user_id))&(~db.pm.read_by.contains(user_id))).count()) +')',_href='#',_class='mail')}} Searched around and found that it can be done this

[web2py] Re: Callable as Field.default

2011-01-30 Thread Anthony
Got it. Thanks. On Sunday, January 30, 2011 6:21:17 PM UTC-5, Massimo Di Pierro wrote: > You should be able to use > > default=f > > Trunk version handles this better than 1.65.6 which has problems with > MethodType. > > Yet if f is an instance with a a __call__ method, it will not call it.

[web2py] Re: Custom form bug

2011-01-30 Thread ionel
I forgot to say that I use my own function to define the fields in the custom form. db.py: db.define_table('a_table', Field('field_name', 'text', length=600)) controller: def copyField(field): return Field(field.name, field.type, length=field.length) form = SQLFORM.factory(copyField(db.a_tabl

Re: [web2py] JSON output errors *hard* to debug

2011-01-30 Thread Jonathan Lundell
On Jan 30, 2011, at 4:39 PM, Art Zemon wrote: > I had a heckuva time this afternoon debugging this code: > # request.extension == 'json' > location = URL(...) > return dict(location=location) > I get getting HTTP 405 errors. It turns out that generic.json uses a > try/except block and thows an HTT

[web2py] Custom form bug

2011-01-30 Thread ionel
Hello, With custom form I can do this "form.table.field_name.length" and I get the field length defined in model file, ex. Field('field_name', 'text', length=200) But for length > 255, ex. Field('field_name', 'text', length=600), I get always 255 in form.table.field_name.length I use MySQL and I

[web2py] JSON output errors *hard* to debug

2011-01-30 Thread Art Zemon
Folks, I had a heckuva time this afternoon debugging this code: # request.extension == 'json' location = URL(...) return dict(location=location) I get getting HTTP 405 errors. It turns out that generic.json uses a try/except block and thows an HTTP 405 error on any exception. The real

Re: [web2py] Re: crud.create next= syntax

2011-01-30 Thread Art Zemon
On 01/30/2011 12:35 PM, Massimo Di Pierro wrote: Valid: next=URL(f=show, args=[id]) next=URL(f=show, args=(id,)) next=URL(f=show, args=id) Massimo, All of those yield .../show/ I am running Version 1.91.6 (2011-01-03 17:55:14) This is not urgent; I switched to using a SQLFORM w

[web2py] Re: problems with conditional login redirection on on_failed_authorization

2011-01-30 Thread Niphlod
sorry this is subtle to spot, but authentication and authorization is a different thing and it's managed differently whether you are allowing basic login or not I did an incorrect assumption making my tests and replying before if you try with the decorator @auth.requires_membership('

[web2py] Bugfix for CheckboxesWidget

2011-01-30 Thread Bernd Rothert
This patch fixes the CheckboxesWidget as a replacement for the MultipleOptionsWidget in "list:reference" fields. "list:reference" fields use the IS_IN_DB(...,multiple=True) validator. Its options() method returns possible choices a list of string tuples (, ) to be used in HTML option tags and chec

Re: [web2py] widgets

2011-01-30 Thread Ovidio Marinho
blza funcionou. 2011/1/30 Alexandre Andrade > IS_IN_DB(db, db.list.id, '%(tasks)s',multiple=True) > > 2011/1/30 Ovidio Marinho > > How to view the contents of multiple options in widgets list.tasks >> >> -- >> Ovidio Marinho Falcao Neto >> ovidio...@gmail.com >> Te

[web2py] Re: CSV import broken?

2011-01-30 Thread howesc
Forcing ID's in GAE is a bit harder, and i don't think that web2py has support for that yet. also note that once the database gets to be of significant size the import/export features will have to be written to run as taskqueue tasks on GAE so that they can run for 10 minutes instead of 30 seco

[web2py] Re: query in DAL

2011-01-30 Thread Massimo Di Pierro
I still do not fully understand so I am making some assumptions. Moreover you use field names either plural (and to me make more sense singular) or not allowed (date). So... db.define_table('item',Field('name',format='%(name)s') db.define_table('stock',Field('item',db.item),Field('type')) db.defin

Re: [web2py] widgets

2011-01-30 Thread Alexandre Andrade
IS_IN_DB(db, db.list.id, '%(tasks)s',multiple=True) 2011/1/30 Ovidio Marinho > How to view the contents of multiple options in widgets list.tasks > > -- > Ovidio Marinho Falcao Neto > ovidio...@gmail.com > Tecnologia da Informaçao > Casa Civil do Governador

[web2py] Re: inconsistency ? "==" and "belongs"

2011-01-30 Thread Massimo Di Pierro
I think your question was excellent. In fact I hate that in, and and or are not overloadable and I do not understand why. On Jan 30, 3:55 pm, Stef Mientki wrote: > of course, stupid of me, > > thanks very much Massimo, > cheers, > Stef

[web2py] Re: Please help me on belongs

2011-01-30 Thread Massimo Di Pierro
distinct does not work on GAE either. On Jan 30, 2:25 pm, "Arun K.Rajeevan" wrote: > x = db(~db.languages.id.belongs(db()._select(db.words.lang, > distinct=True))).select() > > This works fine for sqllite on which I'm developing > > But it doesn't work for appengine. > So I tried, > > lst = db(

[web2py] Re: GAE belongs (how to map long list)

2011-01-30 Thread Massimo Di Pierro
BELONGS works. ~BELONGS does not on GAE I think. On Jan 30, 1:51 pm, "Arun K.Rajeevan" wrote: > Oops, I made an assumption "it worked for me with python sdk for appengine > using dev_appserver.py" > > That was wrong. > > BELONGS is broken in gae. > db(~db.languages.id.belongs(db()._select(db.word

[web2py] Re: Callable as Field.default

2011-01-30 Thread Massimo Di Pierro
You should be able to use default=f Trunk version handles this better than 1.65.6 which has problems with MethodType. Yet if f is an instance with a a __call__ method, it will not call it. For instancetype it will try serialize it with __str__. On Jan 30, 1:36 pm, Anthony wrote: > On Friday,

[web2py] Re: table field with reference to other in read-only mode doesn't appear right

2011-01-30 Thread Massimo Di Pierro
I cannot reproduce this. Can you help me? Can you edit gluon/dal.py and the function _listify, add a print statement before it returns. Try reproduce the error. What does it print? On Jan 30, 11:29 am, szimszon wrote: > Now, there is a programming error in nightly build (source version) > [pgsql

Re: [web2py] query in DAL

2011-01-30 Thread Ovidio Marinho
I am doing an inventory system, you could help me with some example? 2011/1/28 beto (R3) > Hey guys: > > Is there a way to do this query in DAL? > > SELECT >date, count(foo.items) > FROM > ( >SELECT >logs.date, logs.items >FROM logs >WHERE >extract(year from logs.

Re: [web2py] Re: problems with conditional login redirection on on_failed_authorization

2011-01-30 Thread Miguel Lopes
On Sun, Jan 30, 2011 at 9:16 PM, Niphlod wrote: > try with auth.settings.on_failed_authorization = > failedAuthHandlerandler() > >  it works for me ^_^ > Not for me! And I can't see how. Miguel

Re: [web2py] Re: inconsistency ? "==" and "belongs"

2011-01-30 Thread Stef Mientki
of course, stupid of me, thanks very much Massimo, cheers, Stef

[web2py] Re: problems with conditional login redirection on on_failed_authorization

2011-01-30 Thread Niphlod
try with auth.settings.on_failed_authorization = failedAuthHandlerandler() it works for me ^_^ On Jan 30, 9:29 pm, Miguel Lopes wrote: > I'm still in need of help. Here's what I've managed to find. > My problem is that if I don't use good credentials in the command line > I get an exception b

[web2py] Re: problems with conditional login redirection on on_failed_authorization

2011-01-30 Thread Niphlod
I'm on my way out as a first thing, try it with auth.settings.on_failed_authorization = failedAuthHandler() On Jan 30, 9:29 pm, Miguel Lopes wrote: > I'm still in need of help. Here's what I've managed to find. > My problem is that if I don't use good credentials in the command line > I get

[web2py] Re: Please help me on belongs

2011-01-30 Thread Arun K.Rajeevan
Also if you want to make sure that x = db(~db.languages.id.belongs(db()._select(db.words.lang, distinct=True))).select() is not working on gae, here is traceback from gae logs Traceback (most recent call last): File "/base/data/home/apps/visuallingua/2.348005112605606701/gluon/restricted.p

[web2py] Re: problems with conditional login redirection on on_failed_authorization

2011-01-30 Thread Miguel Lopes
I'm still in need of help. Here's what I've managed to find. My problem is that if I don't use good credentials in the command line I get an exception because web2py is replying with the login_url. This suggests that the failedAuthHandler I'm using in auth.settings.on_failed_authorization is not wo

[web2py] Please help me on belongs

2011-01-30 Thread Arun K.Rajeevan
x = db(~db.languages.id.belongs(db()._select(db.words.lang, distinct=True))).select() This works fine for sqllite on which I'm developing But it doesn't work for appengine. So I tried, lst = db().select(db.words.lang, distinct=True).as_list() lst = map(lambda x: x['lang'], lst) x = reduce((l

[web2py] widgets

2011-01-30 Thread Ovidio Marinho
How to view the contents of multiple options in widgets list.tasks -- Ovidio Marinho Falcao Neto ovidio...@gmail.com Tecnologia da Informaçao Casa Civil do Governador 83 3214 7885 - 88269088 Paraiba

[web2py] Re: GAE belongs (how to map long list)

2011-01-30 Thread Arun K.Rajeevan
Oops, I made an assumption "it worked for me with python sdk for appengine using dev_appserver.py" That was wrong. BELONGS is broken in gae. db(~db.languages.id.belongs(db()._select(db.words.lang, distinct=True))).select() causes dev_appserver.py to print out File "/home/kra/Evolve/Works/Py

[web2py] Re: Callable as Field.default

2011-01-30 Thread Anthony
On Friday, January 28, 2011 9:32:13 AM UTC-5, Massimo Di Pierro wrote: > > The fact is, you can do both. If you want the values to be evaluated > on insert, just do > > Field(...,default=lambda: f()) What's the difference between using "default=lambda: f()" and just using "default=f" (assum

[web2py] Re: Deployment Confusion

2011-01-30 Thread g...@rtplanb.com
Thank you all for your help so far. I will try your suggestions. I can get SSH access to my host. It runs Python 2.4.3 and Linux distro is quoted as: Linux n1nlftpg005.shr.prod.ams1.secureserver.net 2.6.18-194.26.1.el5PAE #1 SMP Tue Nov 9 13:34:42 EST 2010 i686 i686 i386 GNU/Linux On Jan 30, 4:46

Re: [web2py] Re: Deployment Confusion

2011-01-30 Thread pbreit
It's either not possible or very difficult. GoDaddy's hosting capabilities are extremely limited. As others have mentioned, I'd suggest considering another provider such as WebFaction.

[web2py] Re: table field with reference to other in read-only mode doesn't appear right

2011-01-30 Thread szimszon
No... from gluon.tools import * auth = Auth( globals(), db ) # authentication/ authorization auth.settings.hmac_key = 'sha512:144104...c136' auth.define_tables() # creates all needed tables from gluon.contrib.login_methods.basic_auth import basic_auth f

Re: [web2py] Re: Change in URL args handling

2011-01-30 Thread Jonathan Lundell
On Jan 30, 2011, at 10:29 AM, villas wrote: > >> I don't think that they'll be any cleaner or shorter either way. The only >> way you'll get trailing slashes (if we end up supporting them) is by asking >> for a URL with empty trailing args. If you don't want trailing slashes, then >> don't add

Re: [web2py] Re: can web2py support RESTful api calls? if so any pointers on how to build one?I

2011-01-30 Thread Bruno Rocha
radbox.me has a very nice API http://radbox.me/api/index made with web2py, would be great if that guys could share some information and tips about it. Bruno Rocha http://about.me/rochacbruno/bio

[web2py] Re: crud.create next= syntax

2011-01-30 Thread Massimo Di Pierro
Valid: next=URL(f=show, args=[id]) next=URL(f=show, args=(id,)) next=URL(f=show, args=id) But this next=URL(f=show, args=([id]))) is interpreted as next=URL(f=show, args='[id]') and therefore escaped On Jan 30, 12:05 pm, Art Zemon wrote: > I'm tangled up in the synta

[web2py] Re: table field with reference to other in read-only mode doesn't appear right

2011-01-30 Thread Massimo Di Pierro
do you have a custom auth_user table? How does it look like? On Jan 30, 11:29 am, szimszon wrote: > Now, there is a programming error in nightly build (source version) > [pgsql]: > > Traceback (most recent call last): >   File "/home/szimszon_nfs/web2py/gluon/restricted.py", line 188, in > restri

[web2py] Re: Field custom_store and custom_delete

2011-01-30 Thread Massimo Di Pierro
Good point. There should be a custom delete. I will add it to my todo list. massimo On Jan 30, 11:04 am, Art Zemon wrote: > Massimo, et al, > > I want to extend Field type upload to store in Rackspace Cloud Files (or > anywhere, for that matter). The custom_store attribute of the Field > class g

[web2py] Re: inconsistency ? "==" and "belongs"

2011-01-30 Thread Massimo Di Pierro
because the meaning of "in", "and" and "or" cannot be overloaded in python. This expression: DB.Excel_List.id in (3,4) would always return false because the left hand side is an object and the object is not contained in the right. Because it cannot be overloaded, we canot change its meaning.

[web2py] Re: Change in URL args handling

2011-01-30 Thread villas
> I don't think that they'll be any cleaner or shorter either way. The only way > you'll get trailing slashes (if we end up supporting them) is by asking for a > URL with empty trailing args. If you don't want trailing slashes, then don't > add empty args. Hi, I was mainly thinking of incoming

[web2py] Re: deploying one app to different regions in the world

2011-01-30 Thread Massimo Di Pierro
About 1 I am sure Jonathan has something to day because of the new routing features. About 2. Make sure your database tables have a UUID field. When exporting/importing web2py will use it to rebuild references (the ids will not be synced but you can write a simple program to fix references given t

[web2py] Re: Login form (remember for 30 days not working)

2011-01-30 Thread Arun K.Rajeevan
I see in gae admin interface, we can set cookie expiry time. We have 3 options, 1day, 1week, 2week. In that case, even though the label reads keeps logged in for 30days it'll be in effect for 15 days. How, should I change the label to keep logged in for 15days.

[web2py] crud.create next= syntax

2011-01-30 Thread Art Zemon
I'm tangled up in the syntax for crud.create. I have written form = crud.create(db.assets, message=T('Asset Created'), next=URL(f=show, args=([id]))) But the URL being generated is .../show/%3Cbuilt-in%20function%20id%3E How should I write this? Or do I need to drop back to using a SQ

[web2py] Re: table field with reference to other in read-only mode doesn't appear right

2011-01-30 Thread szimszon
Now, there is a programming error in nightly build (source version) [pgsql]: Traceback (most recent call last): File "/home/szimszon_nfs/web2py/gluon/restricted.py", line 188, in restricted exec ccode in environment File "/home/szimszon_nfs/web2py/applications/raktar/controllers/ default.

[web2py] Re: GAE belongs (how to map long list)

2011-01-30 Thread Arun K.Rajeevan
I know it's an old post Christian, but when time comes I need it to save me.

[web2py] Re: GAE belongs (how to map long list)

2011-01-30 Thread Arun K.Rajeevan
No it doesn't. I deployed application using belongs in GAE, because it worked for me with python sdk for appengine using dev_appserver.py But it didn't when I upload it to appengine. I lost two days wondering. Nothing is logged on appengine logs. Then I changed it to manually selecting each

[web2py] Field custom_store and custom_delete

2011-01-30 Thread Art Zemon
Massimo, et al, I want to extend Field type upload to store in Rackspace Cloud Files (or anywhere, for that matter). The custom_store attribute of the Field class gives me half of what I need. Is there some reason why custom_delete has not been implemented? I'll be glad to do it and contribu

Re: [web2py] Re: Deployment Confusion

2011-01-30 Thread Bruno Rocha
AS I said,I know only two host options where you can simply put the files there and everything runs without the need of configuration. ['Google App Engine', 'webfaction'] In other shared hosts you need to follow some deployment instruction: I guess this slice works for godaddy http://www.web2pysl

[web2py] Re: Is Web2py the right choice for me?

2011-01-30 Thread Massimo Di Pierro
Welcome Panupat Other users may have more to say on this issue, anyway ... web2py has pluggable login methods. One is gluon/contrib/login_methods/ ldap_auth.py. It contains an example of how to use it. It will allow you to login using Active Directory using LDAP. More complex is the issue with gr

[web2py] inconsistency ? "==" and "belongs"

2011-01-30 Thread Stef Mientki
hello, I thought the DAL was ment to be Pythonic. Writing a query to search for a records with some specific id, I have to use the Pythonic "==" instead of the SQL-like "=" Rows = DB ( DB.Excel_List.id == 3 ).select() Writing a query to search for a records with some a range of id's, I have to u

[web2py] deploying one app to different regions in the world

2011-01-30 Thread VP
I have never configured an app like this so I have no idea how this is done. So, any help or pointer is greatly appreciated. Basically, I have an app. If it is hosted in the US, then access in Asia will be slow. And conversely, if it is hosted in Asia, US access will be slow. So, I think the b

[web2py] Re: Deployment Confusion

2011-01-30 Thread g...@rtplanb.com
Thank you for the advice, but as I already have a years domain and hosting with godaddy I was hoping for some specific advice regarding setup using that service. godaddy support suggest that I simply upload all the files from my web2py application but I asssume this will not give me admin interface

[web2py] Is Web2py the right choice for me?

2011-01-30 Thread Panupat
I just discovered web2py. I'm wondering if web2py is the right choice for me. Would greatly appreciate any input :) A little background is that I'm a PHP user and a 3D artist. So Python has always been on the top of the to-learn list because it can be used with MAX and MAYA. I recently was given

[web2py] Re: table field with reference to other in read-only mode doesn't appear right

2011-01-30 Thread Massimo Di Pierro
This should be fixed in trunk (and nightly build).Please give it a try and confirm. Massimo On Jan 30, 7:46 am, szimszon wrote: > I wonder if somebody could help me. > > Here is my Field: > >     Field( 'updated_by', db.auth_user, >                                         writable = False  ) > >

Re: [web2py] Re: Email as username

2011-01-30 Thread Kenneth Lundström
Thanks HC. The book holds a lot of information, not allways so easy to find. :=) Kenneth Even easier - as I only saw now (always worthwhile to reread the book every so often) """ (w2p book Ch 8) To start using Auth, you need at least this code in a model file, which is also provided with th

Re: [web2py] Re: web2py and gae : Delete everything in the datastore

2011-01-30 Thread Nathan VanHoudnos
It worked. :) On Sat, Jan 29, 2011 at 6:03 PM, devGS wrote: > Great than. From my experience with that future, it takes time to > delete in bulk and the process is is splitted into hours in order to > save your CPU time. You can track the process through your datastore > panels, task queue, etc.

[web2py] table field with reference to other in read-only mode doesn't appear right

2011-01-30 Thread szimszon
I wonder if somebody could help me. Here is my Field: Field( 'updated_by', db.auth_user, writable = False ) CRUD rendered it in form "None" but the record has a value 1 and I have user in auth_user.id=1 If I modify the Field to: Field( 'updated_

[web2py] table field with reference to other in read-only mode doesn't appear right

2011-01-30 Thread szimszon
I wonder if somebody could help me. Here is my Field: Field( 'updated_by', db.auth_user, writable = False ) CRUD rendered it in form "None" but the record has a value 1 and I have user in auth_user.id=1 If I modify the Field to: Field( 'updated_

Re: [web2py] Forcing SSL on certain requests;

2011-01-30 Thread David J.
Philip; Yes; I suppose that would work; Thanks for the advice; It is appreciated. Have a good day. On 1/30/11 2:41 AM, Philip Kilner wrote: Hi David, On 30/01/2011 01:02, David J. wrote: Is there a utility available to force requests to SSL? (ex: Login, Register, etc..) Are you behind

[web2py] problems with conditional login redirection on on_failed_authorization

2011-01-30 Thread Miguel Lopes
on_failed_authorization can be a URL or a function. I'm think I could use this to achieve conditional login redirection. A use case would be service calls returning a simple string (or a JSON or an XML reply to non-validated requests), while still allowing for regular (non-service requests) to be r

[web2py] Re: Email as username

2011-01-30 Thread hcvst
Even easier - as I only saw now (always worthwhile to reread the book every so often) """ (w2p book Ch 8) To start using Auth, you need at least this code in a model file, which is also provided with the web2py "welcome" application and assumes a db connection object: from gluon.tools import Aut

[web2py] Re: Email as username

2011-01-30 Thread hcvst
Hi Kenneth, remove the 'username' field from the auth_user table. Also see Chapter 8 http://web2py.com/book/default/chapter/08 on custom tables. I think in the past w2p only used email by default. The new app wizard appears to include it now. Regards, HC On Jan 30, 11:13 am, Kenneth Lundström

Re: [web2py] Re: Fwd: web2py basic auth

2011-01-30 Thread Miguel Lopes
You got me in the right direction. Txs. I'll be starting a separate thread on what I'm trying to achieve, so far without success. On Sat, Jan 29, 2011 at 8:13 PM, Niphlod wrote: > sorry, my mistake! > > On Jan 29, 4:01 pm, Miguel Lopes wrote: >> gluons/tools.py >> >> Txs, >> Miguel >> >> On Sat

[web2py] Email as username

2011-01-30 Thread Kenneth Lundström
Hello list, I have an old application build two years ago and it uses email adress as the username, so you don´t need a different username. Now I´d like to do the same on a new application but I don´t know what to change to do this. Any ideas? Kenneth