[web2py] Re: Is this a possible bug?

2010-04-11 Thread Matt
Ok thanks for your reply. That makes sense. Matt On Apr 12, 4:13 pm, mdipierro wrote: > No. This is correct. If you had > > "1|2|11" in the field how would you write a sql query to seach for > "1"? > > If you have "|1|2|11|" you can look for LIKE '%|1|%' and there is no > ambiguity. > > Massimo

[web2py] Re: Is this a possible bug?

2010-04-11 Thread mdipierro
No. This is correct. If you had "1|2|11" in the field how would you write a sql query to seach for "1"? If you have "|1|2|11|" you can look for LIKE '%|1|%' and there is no ambiguity. Massimo On Apr 11, 10:57 pm, Matt wrote: > Also if I choose both values in the select you get: > > Accepted Va

[web2py] Re: Is this a possible bug?

2010-04-11 Thread Matt
Also if I choose both values in the select you get: Accepted Variables locations : |1|2| Whereas I would have expected it to be: Accepted Variables locations : 1|2 Looking at validators.py lines 297/8 if self.multiple: return ('|%s|' % '|'.join(value

Re: [web2py] Re: the web2py book, source code

2010-04-11 Thread Thadeus Burgess
Double posting... and that ends the rein of using Evolution for a mail client :) -Thadeus On Sun, Apr 11, 2010 at 9:58 PM, mdipierro wrote: > remove that file. I do not know. > > On Apr 11, 8:12 pm, Thadeus Burgess wrote: >> I also notice, I continue to receive the following message from t

[web2py] Re: the web2py book, source code

2010-04-11 Thread mdipierro
remove that file. I do not know. On Apr 11, 8:12 pm, Thadeus Burgess wrote: > I also notice, I continue to receive the following message from the > terminal. > > __db_meta_setup: > /home/thadeusb/web2py/applications/book/cache/cache.shelve.db: unexpected > file type or format > > Everything see

[web2py] Re: Self join query missing AS

2010-04-11 Thread mdipierro
yes and no. this NO thisq = db(db.keyword.keyword == 'this')._select(db.keyword.question) result = db(db.question.id.belongs(thisq)).select(db.question.ALL) but this YES thisq = [r.question for r in db(db.keyword.keyword == 'this').select(db.keyword.question)] result = db(db.question.id.belongs

Re: [web2py] the web2py book, source code

2010-04-11 Thread Thadeus Burgess
I also notice, I continue to receive the following message from the terminal. __db_meta_setup: /home/thadeusb/web2py/applications/book/cache/cache.shelve.db: unexpected file type or format Everything seems to work just fine though. -- ThadeusB On Sun, 2010-04-11 at 13:06 -0700, mdipierro wro

[web2py] Re: Self join query missing AS

2010-04-11 Thread Paul Wray
Please disregard last question - nested select does seem to work using the same chaining technique: thisq = db(db.keyword.keyword == 'this')._select(db.keyword.question) thatq = db(db.keyword.keyword == 'that') (db.keyword.belongs(thisq))._select(db.keyword.question) result = db(db.question.id.bel

Re: [web2py] the web2py book, source code

2010-04-11 Thread Thadeus Burgess
Awesome! Great work Massimo, In db_book.py can you replace def tt with gluon.prettydate? And I just noticed... we can open binary files in the online editor? I never knew ! >.< -- ThadeusB On Sun, 2010-04-11 at 13:06 -0700, mdipierro wrote: > Since many of you have asked > > http://web2p

[web2py] Re: Self join query missing AS

2010-04-11 Thread mdipierro
On Apr 11, 7:40 pm, Paul Wray wrote: > Thank you Massimo > > I didnt know about the chained queries like this ie db(q1)(q2)  . > Is this feature documented in the book? yes db()() is the same as db(()&()) > I like how this allows a neat construction for n keywords: > > q = db() > for k in keyw

[web2py] Re: a bug in sqlhtml

2010-04-11 Thread mdipierro
You are right you have to do the filter fields for update forms (not for create forms) because update forms contain the id and it cannot be an attribute of insert. Insert could remove it automatically thou. On Apr 11, 6:32 pm, "hamdy.a.farag" wrote: > If this would be a problem, I already did so

Re: [web2py] Re: Self join query missing AS

2010-04-11 Thread Thadeus Burgess
Sorry, try this db(db.question.id == db.keyword.id)(db.keyword.keyword == 'this')(db.keyword.keyword == 'that').select() -Thadeus On Sun, Apr 11, 2010 at 7:46 PM, Thadeus Burgess wrote: > Does the following provide the results that you are looking for? > > db(db.question.id > 0)(db.keyword

Re: [web2py] Re: Self join query missing AS

2010-04-11 Thread Thadeus Burgess
Does the following provide the results that you are looking for? db(db.question.id > 0)(db.keyword.keyword == 'this')(db.keyword.keyword == 'that').select() -Thadeus On Sat, Apr 10, 2010 at 9:36 AM, mdipierro wrote: > I would do > > db(db.question.id.belongs(db(db.keyword.keyword=='this')).

[web2py] Re: Self join query missing AS

2010-04-11 Thread Paul Wray
Thank you Massimo I didnt know about the chained queries like this ie db(q1)(q2) . Is this feature documented in the book? I like how this allows a neat construction for n keywords: q = db() for k in keywords: q = q(db.question.id.belongs(db(db.keyword.keyword = k).select(db.qkeyword.questi

[web2py] Re: Self join query missing AS

2010-04-11 Thread Paul Wray
Thank you Massimo I didnt know about the chained queries like this ie db(q1)(q2) . Is this feature documented in the book? I like how this allows a neat construction for n keywords: q = db() for k in keywords: q = q(db.question.id.belongs(db(db.keyword.keyword = k).select(db.qkeyword.questi

[web2py] Re: a bug in sqlhtml

2010-04-11 Thread hamdy.a.farag
If this would be a problem, I already did solved it, as I could remember by doing something like form=SQLFORM(db.table) if form.accepts(...,dbio=False): request.vars.image = form.vars.image_newfilename .. btw: I guess db.table.insert(**form.vars) also is not working I've to do

[web2py] Re: a bug in sqlhtml

2010-04-11 Thread mdipierro
I think the issue is that people want to do form=SQLFORM(db.table) if form.accepts(...,dbio=False): db.table.insert(**form.vars) This works always except if form.vars.name is an upload field. In that case the correct value is in form.vars.name_newfilename instead of where people expect it to

[web2py] Re: Display Image from FieldStorage

2010-04-11 Thread mdipierro
Please show us your code. On Apr 11, 1:23 pm, Francisco Costa wrote: > Hello, > I'm using a custom form that has an upload field in the model. > When i submit the form I use a request.vars.name and saves the file as > an FieldStorage.. > I don't know if the file is uploaded and how I can access i

[web2py] Re: Display Image from FieldStorage

2010-04-11 Thread Francisco Costa
still didn't found how to solve this problem.. :/ any help? On Apr 11, 7:23 pm, Francisco Costa wrote: > Hello, > I'm using a custom form that has an upload field in the model. > When i submit the form I use a request.vars.name and saves the file as > an FieldStorage.. > I don't know if the file

[web2py] Re: Web2py YAML Model Translator

2010-04-11 Thread blackthorne
Thank you, yes, this is a little more than a proof of concept but my idea is to extend it has needed. There could even be a "template manager" where people could associate options with parts of the model to be included (integrated with the web interface). To make things clear, I think a good pract

[web2py] Re: a bug in sqlhtml

2010-04-11 Thread Yarko Tymciurak
I am not clear - what is the problem this is supposed to be solving? What is the expected behavior? What is the actual behavior? If there is a problem, are there other ways to deal with the problem? - Yarko On Apr 11, 3:09 pm, mdipierro wrote: > h... somehody my answer was not posted, rep

[web2py] Re: a bug in sqlhtml

2010-04-11 Thread hamdy.a.farag
Hi Massimo, if this could break backward compatibility, The problem could be solved by doing the equality on the web application itself in the accepts() function but this has to be considered to be documented if you took that path -- To unsubscribe, reply using "remove me" as the subject.

[web2py] Re: a bug in sqlhtml

2010-04-11 Thread mdipierro
h... somehody my answer was not posted, reposting it Hi Hamdy, you raise a good issue. I am forwarding to the list to see what people think about this in respect to backward compatibility. Eight now when form=SQLFORM(db.define_table('sometable',Field('somefield','upload'))) form.accep

[web2py] the web2py book, source code

2010-04-11 Thread mdipierro
Since many of you have asked http://web2py.com/appliances/default/show/59 Mind that this is not using plugins and lots of the code in there is being rewritten in a modular way using plugins. -- To unsubscribe, reply using "remove me" as the subject.

[web2py] Re: csv download: how to do it

2010-04-11 Thread Yarko Tymciurak
On Apr 11, 2:39 pm, Johann Spies wrote: > With the help of firebug I determined that the problem was the link. > > I have changed the Controller to export the following: > >  link=A('Download as csv',_href=URL(r=request,f='csv',args=query)) > > And that resulted in a " Invalid request"  error. The

[web2py] Re: a bug in sqlhtml

2010-04-11 Thread hamdy.a.farag
sorry for the adds , I don't use may mail usually to post in the group -- To unsubscribe, reply using "remove me" as the subject.

RE: [web2py] Re: a bug in sqlhtml

2010-04-11 Thread Hamdy Abdel-Badeea
here's the patch FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop! Check it out at http://www.inbox.com/marineaquarium -- To unsubscribe, reply using "remove me" as the subject. patch.dat Descri

Re: [web2py] Re: csv download: how to do it

2010-04-11 Thread Johann Spies
With the help of firebug I determined that the problem was the link. I have changed the Controller to export the following: link=A('Download as csv',_href=URL(r=request,f='csv',args=query)) And that resulted in a " Invalid request" error. The url was: http://localhost:8000/sadec/default/csv/L

[web2py] Re: a bug in sqlhtml

2010-04-11 Thread hamdy.a.farag
There's likely a bug in sqlhtml preventing images to be stored correctly in db in case of using SQLFORM(db.table) where db.tale has a field of type 'upload' and the field is used to upload an image , this happens only when using if form.accepts(request,vars, session, dbio=False): blahblahblah

[web2py] Re: new feature idea

2010-04-11 Thread mdipierro
This also does it http://www.web2py.com/AlterEgo/default/show/258 and could easily be turned into a plugin. On Apr 11, 2:28 pm, Rafael Pinheiro wrote: > Nice, this slice does way closer to what i had in mind than my approach. > > Haven't tested it, but it's is a lot better to open as a modal jq

Re: [web2py] Re: new feature idea

2010-04-11 Thread Rafael Pinheiro
Nice, this slice does way closer to what i had in mind than my approach. Haven't tested it, but it's is a lot better to open as a modal jquery dialog, update the combo without refresh and select the new record automatically. In my opinion it should be a feature in web2py, it gives the apps a bett

[web2py] Re: new feature idea

2010-04-11 Thread mdipierro
There is also this: http://www.web2pyslices.com/main/slices/take_slice/11 but I think we can do better than both by merging both approaches. Massimo On Apr 11, 1:36 pm, Rafael Pinheiro wrote: > It expects an url where you could insert a new record. Right now all it does > is open a link on a ne

[web2py] Re: Trouble starting web2py

2010-04-11 Thread muybay
Yikes, I was a little to quick on the send button... To finish that slightly off-topic thought, I think we have a better chance of incorporating our fork with pyfacebook. On Apr 11, 1:37 pm, muybay wrote: > I am encountering something similar with pyfacebook, we are basically > dealing with fork

[web2py] Re: Trouble starting web2py

2010-04-11 Thread muybay
I am encountering something similar with pyfacebook, we are basically dealing with forking woes. Simplejson looks like a well-maintained package, I think the clean solution would be for them to incorporate our changes but realistically that may not be feasible. So upgrading, patching and changing

[web2py] new feature idea

2010-04-11 Thread Rafael Pinheiro
It expects an url where you could insert a new record. Right now all it does is open a link on a new tab, so anything that could go into a href would work. On my model i did like that: requires=IS_IN_DB(db, db.auth_user.id, insert_url=URL(a=request.application, c='appadmin', f= 'insert', args=['db

[web2py] Re: csv download: how to do it

2010-04-11 Thread Yarko Tymciurak
On Apr 11, 1:10 pm, Thadeus Burgess wrote: > If you are running local just print to stdout > > print request.vars.query. You can also use the display of these (for debuggin) on your page - see how welcome/views/generic.html accomplishes this. Then there is firebug (firefox), and - if you _really

[web2py] Display Image from FieldStorage

2010-04-11 Thread Francisco Costa
Hello, I'm using a custom form that has an upload field in the model. When i submit the form I use a request.vars.name and saves the file as an FieldStorage.. I don't know if the file is uploaded and how I can access it. I would like to have the file upload to appname/uploads directory as if I used

[web2py] Re: a bug in sqlhtml

2010-04-11 Thread Yarko Tymciurak
On Apr 11, 12:42 pm, "hamdy.a.farag" wrote: > Hi > > There's a bug in sqlhtml preventing proper image storage in database > in case of using     dbio=False In general, it would be good to setup the case of what you think is a bug, and how to reproduce (here on the groups is a good place). I tend

Re: [web2py] new feature idea

2010-04-11 Thread Thadeus Burgess
Nice, and this way insert_url is anything that you want it to be? -Thadeus On Sun, Apr 11, 2010 at 12:35 PM, Rafael Pinheiro wrote: > For some time i am missing a small feature on web2py, the IS_IN_DB validator > forces the widget to be a OptionWidget populated from the database, but if i >

Re: [web2py] Re: csv download: how to do it

2010-04-11 Thread Thadeus Burgess
If you are running local just print to stdout print request.vars.query. -Thadeus On Sun, Apr 11, 2010 at 12:32 PM, Johann Spies wrote: > Thanks Thaddeus.  I am not winning (yet)! > > I have now: > > > def csv(): >    import cStringIO >    s=cStringIO.StringIO() >    import gluon.conttenttyp

[web2py] Re: Search Function

2010-04-11 Thread Francisco Costa
It worked! I'll try to follow the pdf for now on. Thank you very much! On Apr 11, 6:35 pm, "mr.freeze" wrote: > The automatic conversion from latex causes formatting errors in the > online book. I would look at the same example in the pdf version > (labeled page 75). > > Try changing this in bg_f

[web2py] Help with Datatables

2010-04-11 Thread Varun
I'm filling a datatable using auth_user table but unable to customise data which goes into hidden rows. I've attached an image, which highlights portions where I want to get custom data into. Custom data I want is any query like: db(id == db.auth_event.user_id).select(db.auth_event.time_stam

[web2py] a bug in sqlhtml

2010-04-11 Thread hamdy.a.farag
Hi There's a bug in sqlhtml preventing proper image storage in database in case of using dbio=False Massimo, I sent you a patch that fixed it , have you noticed it ? -- To unsubscribe, reply using "remove me" as the subject.

[web2py] new feature idea

2010-04-11 Thread Rafael Pinheiro
For some time i am missing a small feature on web2py, the IS_IN_DB validator forces the widget to be a OptionWidget populated from the database, but if i need to add a new record to the table that populates it i have to open a new tab on my browser, add the new record and realod the form to get the

[web2py] Re: Search Function

2010-04-11 Thread mr.freeze
The automatic conversion from latex causes formatting errors in the online book. I would look at the same example in the pdf version (labeled page 75). Try changing this in bg_find: pattern = '+ request.vars.keyword.lower() + ' to this: pattern = '%' + request.vars.keyword.lower() + '%' On Apr

Re: [web2py] Re: csv download: how to do it

2010-04-11 Thread Johann Spies
Thanks Thaddeus. I am not winning (yet)! I have now: def csv(): import cStringIO s=cStringIO.StringIO() import gluon.conttenttype query = request.vars.query if not query: return None else: db(request.vars.query).select(db.sarua.ALL,limitby=(0,250)).expor

[web2py] Re: Search Function

2010-04-11 Thread Francisco Costa
Anyone can give me some example on this? Thank you On Apr 8, 7:38 pm, Francisco Costa wrote: > Hello, > i was trying to implement a search function so I've tried this wiki > example (http://web2py.com/book/default/section/3/9) > I can create pages, but I cannot search for them. > Is the search fu

Re: [web2py] Authentication: form just refreshes, won't validate login

2010-04-11 Thread Keith Edmunds
Problem solved. For the sake of others searching on this: some of the distribution files under applications/my_app were from an earlier version of web2py. -- To unsubscribe, reply using "remove me" as the subject.

[web2py] Re: Strange behavior for Storage object

2010-04-11 Thread mdipierro
yes On Apr 11, 9:46 am, Mathieu Clabaut wrote: > On Sun, Apr 11, 2010 at 16:31, mdipierro wrote: > > I think the problem is is that request.vars.file is a cgi.FieldStorage > > object and it lacks a __zero__ method therefore it incorrectly > > evaluates to false even if the object is present. Thi

Re: [web2py] Re: Encoding using as_dict not using UTF-8?

2010-04-11 Thread Tito Garrido
I could test it on Shell, not sure why it's happening: In[0]: p=db(db.paciente.id>0).select()[1].as_dict() Out[0]: In[1]: p Out[1]: *{'bairro': 'Gra\xc3\xa7a',* 'telefone_residencial': '', 'numero': '492', 'mae': '', 'celular': '', 'pai': '', 'data': '2009-10-20', 'id': 2, 'telefone_comercial

Re: [web2py] Re: Encoding using as_dict not using UTF-8?

2010-04-11 Thread Tito Garrido
In fact looks like it loses the UTF-8 enconding when I print it or convert it to string... Is there a way to re encode it? Regards, tito On Sun, Apr 11, 2010 at 11:35 AM, mdipierro wrote: > Are you tell me that > > items=db(db.mytable.id>0).select(limitby=(0,1)) > print items[0].as_dict() > f

Re: [web2py] Re: Strange behavior for Storage object

2010-04-11 Thread Mathieu Clabaut
On Sun, Apr 11, 2010 at 16:31, mdipierro wrote: > I think the problem is is that request.vars.file is a cgi.FieldStorage > object and it lacks a __zero__ method therefore it incorrectly > evaluates to false even if the object is present. This is an error in > the book. Ah yes... I've looked in

[web2py] for mac uses, useful

2010-04-11 Thread mdipierro
http://www.paulhammond.org/webkit2png/ -- To unsubscribe, reply using "remove me" as the subject.

[web2py] Re: Encoding using as_dict not using UTF-8?

2010-04-11 Thread mdipierro
Are you tell me that items=db(db.mytable.id>0).select(limitby=(0,1)) print items[0].as_dict() for item in items: print item.as_dict() produce two different outputs? It cannot be. Massimo On Apr 11, 9:00 am, Tito Garrido wrote: > I can get it as UTF-8 if I execute: > test=db(db.mytable.id>0).s

[web2py] Re: Strange behavior for Storage object

2010-04-11 Thread mdipierro
I think the problem is is that request.vars.file is a cgi.FieldStorage object and it lacks a __zero__ method therefore it incorrectly evaluates to false even if the object is present. This is an error in the book. Anyway, the actualy filename is now atumatically base16 encoded in the web2py-assigne

[web2py] Re: Trouble starting web2py

2010-04-11 Thread mdipierro
What's your advice about this? Out r version of simplejson is patched to serialize dates. We could upgrade to the latest and re-patch and for now this problem will go away but this is not a long term solution. Clearly we must change something in the way simplejson is imported to avoid conflict. M

[web2py] Strange behavior for Storage object

2010-04-11 Thread matclab
Hello all, I've just tried the recipe from the book p197 : "Storing the original filename", and I've stumbled upon the following strange behavior : The following piece of code doesn't work (never get inside the IF) if request.vars.file: print "In the IF" form.vars.file_file

[web2py] Re: zipimport web2py.zip for appengine

2010-04-11 Thread mdipierro
this is not a bad idea it should be possible to write a simple script to build the web2py.zip and modify gaehandler to use zipimport. Any takers? On Apr 11, 8:12 am, sam lee wrote: > Hi, > > I have a few applications that I would like to deploy to single > appengine app (say, example.appspot.com)

[web2py] Re: Web2py YAML Model Translator

2010-04-11 Thread mdipierro
This is fantastic. I think this should be integrated in web2py or at least provide a plugin for it (assuming there is a pure python yaml parser with compatible license and I think yes) I also think, along this line there is even more we can do: *) use the yaml also to define which actions are nee

Re: [web2py] Re: Encoding using as_dict not using UTF-8?

2010-04-11 Thread Tito Garrido
I can get it as UTF-8 if I execute: test=db(db.mytable.id>0).select()[0].as_dict() return test Not sure why it's not encoding on the former situation. How could I convert it manually? Thanks! On Sun, Apr 11, 2010 at 2:15 AM, mdipierro wrote: > I am not sure the issue is web2py here. It may b

[web2py] Re: Trouble starting web2py

2010-04-11 Thread muybay
I have the issue also. I am going to try this suggestion and possibly diff the two versions (upgraded vs web2py simplejson). On Apr 8, 8:00 am, mdipierro wrote: > One solution is to upgrade thesimplejsonthat comes with web2py. The > problem is that the one we use has been modified to handle dates

[web2py] zipimport web2py.zip for appengine

2010-04-11 Thread sam lee
Hi, I have a few applications that I would like to deploy to single appengine app (say, example.appspot.com). I was wondering if I can have the following directory structure: appengine_proj/ web2py.zip gaehandler.py app.yaml applications/ application1 application2

[web2py] Re: Web2py YAML Model Translator

2010-04-11 Thread blackthorne
For some reason the attachment didn't came up. Here is the missing code: http://bit.ly/dgv8Qb Best Regards On Apr 11, 1:37 pm, Francisco Ribeiro wrote: > hi > > here is something I have done on web2py so you can define models using the > YAML lang. > I also included a 12 min screencast to show