[web2py] Best way to send a web2py patch
Is there a recommended way to send a patch for web2py? I was looking for something like github's equivalent of pull request, but did not seem to find it. It will be great if this is documented on the web2py website, if not already done so. The following is just a fix to improve readability in the web2py wizard. $ hg diff diff -r 3ff6947c13bb applications/admin/static/css/styles.css --- a/applications/admin/static/css/styles.css Thu Jun 30 19:28:06 2011 -0500 +++ b/applications/admin/static/css/styles.css Sun Jul 03 14:59:37 2011 +0800 @@ -828,6 +828,7 @@ .step li { list-style: none; margin-left: 1em; + margin-top: 0.5em; } .step #wizard_nav .box {
[web2py] Re: ekjaa
Thank you all for the kind words! Yes, it is a web2py website :) @Mikech: We are in the process of fixing the bugs and it should be resolved soon. We request you all to go through the website and let us know your feedback. It will help us greatly in further enhancing the website. You can contact me at mohit.gu...@ekjaa.org for any queries/feedback. Regards Mohit On Jun 23, 9:46 pm, Anthony wrote: > On Thursday, June 23, 2011 12:38:29 PM UTC-4, mikech wrote: > > > Is this a web2py site? > > Yes, you can tell if you look at the meta tags in the html head. The http > response also includes x-powered-by=web2py.
[web2py] Re: Best way to send a web2py patch
I added your suggestion to trunk. This is the proper way to report an issue: http://code.google.com/p/web2py/issues/entry In most cases it is a good idea to first discuss it here. If no response or if you have a patch (like in this case), then open the issue. Thank you. massimo On Jul 3, 2:18 am, Luther Goh Lu Feng wrote: > Is there a recommended way to send a patch for web2py? I was looking > for something like github's equivalent of pull request, but did not > seem to find it. It will be great if this is documented on the web2py > website, if not already done so. > > The following is just a fix to improve readability in the web2py > wizard. > > $ hg diff > diff -r 3ff6947c13bb applications/admin/static/css/styles.css > --- a/applications/admin/static/css/styles.css Thu Jun 30 19:28:06 > 2011 -0500 > +++ b/applications/admin/static/css/styles.css Sun Jul 03 14:59:37 > 2011 +0800 > @@ -828,6 +828,7 @@ > .step li { > list-style: none; > margin-left: 1em; > + margin-top: 0.5em; > } > > .step #wizard_nav .box {
[web2py] Re: Social network plug-in
Looking through the source code, I deduce that db(db.connection.source==auth.user_id) (db.connection.target==request.args(1)).delete() is the same as db((db.connection.source==auth.user_id)) & (db.connection.target==request.args(1))).delete() Is this new syntax? I did not recall reading it in the book. Pls point me to the section in the book if it is already there. Tks! On Jun 12, 12:09 am, Massimo Di Pierro wrote: > Here is the source of the facebook clone > > web2py.app.friends.w2p > 1002KViewDownload
[web2py] question about count()
To the best of my knowledge, count() doesn't take an argument, such as left. I would like to be proven wrong. If so, then how do we count if there's a left join, except by doing a select and then a len(db(query).select(...left=[...]))? Seems like it should be able to do db(query).count(left=[...]).
[web2py] autocomplete widget does not work on GAE
I've checked autocomplete widget can not work in gae, as it uses like in its callback. Checking this group archives, I've found this thread: https://groups.google.com/d/topic/web2py/HdnWTp7h3Do/discussion but even if it looks like it would work, finally it was not implemented. So, does anybody know of any workaround to make autocomplete work in GAE? BTW: A note should be added at the web2py book section (http://www.web2py.com/book/default/chapter/07#Autocomplete-Widget ) warning it does not work in gae. It will save time to many people. Regards. José L.
Re: [web2py] autocomplete widget does not work on GAE
I dont know about autocomplete widget, but, for 'like' in GAE you can use Row.find() term = "something" pages = db(db.table.id>0).select().find(lambda row : row.field.startswith(term) or row.field.endswith(term) or row.field == term or term in row.field) On Sun, Jul 3, 2011 at 12:53 PM, José L. wrote: > I've checked autocomplete widget can not work in gae, as it uses like in > its callback. > Checking this group archives, I've found this thread: > https://groups.google.com/d/topic/web2py/HdnWTp7h3Do/discussion > but even if it looks like it would work, finally it was not implemented. > > So, does anybody know of any workaround to make autocomplete work in GAE? > > BTW: A note should be added at the web2py book section ( > http://www.web2py.com/book/default/chapter/07#Autocomplete-Widget ) > warning it does not work in gae. It will save time to many people. > > Regards. > José L. > -- -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
Re: [web2py] autocomplete widget does not work on GAE
startswith and endswith are not supported in GAE either 2011/7/3 Bruno Rocha : > I dont know about autocomplete widget, but, for 'like' in GAE you can use > Row.find() > > term = "something" > pages = db(db.table.id>0).select().find(lambda row : > row.field.startswith(term) or row.field.endswith(term) or row.field == term > or term in row.field) > > On Sun, Jul 3, 2011 at 12:53 PM, José L. wrote: >> >> I've checked autocomplete widget can not work in gae, as it uses like in >> its callback. >> Checking this group archives, I've found this >> thread: https://groups.google.com/d/topic/web2py/HdnWTp7h3Do/discussion >> but even if it looks like it would work, finally it was not implemented. >> So, does anybody know of any workaround to make autocomplete work in GAE? >> BTW: A note should be added at the web2py book section >> (http://www.web2py.com/book/default/chapter/07#Autocomplete-Widget ) warning >> it does not work in gae. It will save time to many people. >> Regards. >> José L. > > > -- > > > > -- > Bruno Rocha > [ About me: http://zerp.ly/rochacbruno ] > [ Aprenda a programar: http://CursoDePython.com.br ] > [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] > [ Consultoria em desenvolvimento web: http://www.blouweb.com ] >
Re: [web2py] question about count()
the only argument you can pass to count() is a fieldname, so it will count using DISTINCT >>> db(db.products.id>0)._count('id') 'SELECT count(DISTINCT id) FROM products WHERE (products.id > 0)' Left Joins are Row objects, so this object is a fetched rows from database, there no way (that I know) to do a left join in a Query or Set objects. len(db().select(.)) # seems to be the only way. To minimize the db charge, do the counte by less columns not using .ALL (*) total = len(db().select(db.products.id, db.orders.id, left=db.orders.on(db.products.id== db.orders.id) ) ) On Sun, Jul 3, 2011 at 12:32 PM, weheh wrote: > To the best of my knowledge, count() doesn't take an argument, such as > left. I would like to be proven wrong. If so, then how do we count if > there's a left join, except by doing a select and then a > len(db(query).select(...left=[...]))? Seems like it should be able to > do db(query).count(left=[...]). -- -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
[web2py] Re: problem with gae deployment
actually i install 2.5 but still is not working after i install ubuntu 11.4 all problem is coming anyway thanks ..i'll try again. On Jun 1, 5:38 am, José Luis Redrejo Rodríguez wrote: > 2011/6/1 ramkrishan bhatt : > > > > > > > > > > > $ cd workspace/Running\ Project/ > > ramkrishan@ramkrishan-Aspire-5740:~/workspace/Running Project$ > > /home/ramkrishan/Downloads/Python-2.5.5/./python > > google_appengine/dev_appserver.py coporategift/web2py/ > > Traceback (most recent call last): > > File "google_appengine/dev_appserver.py", line 76, in > > run_file(__file__, globals()) > > File "google_appengine/dev_appserver.py", line 72, in run_file > > execfile(script_path, globals_) > > File "/home/ramkrishan/workspace/Running > > Project/google_appengine/google/appengine/tools/dev_appserver_main.py", line > > 146, in > > from google.appengine.tools import appcfg > > File "/home/ramkrishan/workspace/Running > > Project/google_appengine/google/appengine/tools/appcfg.py", line 69, in > > > > from google.appengine.tools import appengine_rpc > > File "/home/ramkrishan/workspace/Running > > Project/google_appengine/google/appengine/tools/appengine_rpc.py", line 27, > > in > > import fancy_urllib > > File "/home/ramkrishan/workspace/Running > > Project/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line > > 341, in > > class FancyHTTPSHandler(urllib2.HTTPSHandler): > > AttributeError: 'module' object has no attribute 'HTTPSHandler' > > > please tell me the solution ... i am using ubuntu 10.10 > > Have you tried Googling a little bit? > Copying and paste your error message Google will give you the reason > of your error (wrong python version) and solution (install python2.5) > in the first result. > > Regards
Re: [web2py] autocomplete widget does not work on GAE
For me it is supported.. take a look, this is a plugin_wiki based "outdated" website http://web2pybrasil.appspot.com (the search box called 'Busca') The code behind: @staticmethod def searchPages(string=None,nfmessage='Nothing found with %s'): string = request.vars.search pages = db(db.plugin_wiki_page.id>0).select().find(lambda row:string and (string in row.slug or string in row.body or string in row.title) and not row.slug.*startswith*('meta')) if pages: return 'Resultados %s ' % UL(*[LI(A(XML(page.title),_href=URL(request.application,'plugin_wiki','page',args=page.slug))) for page in pages]) else: return nfmessage % string else: return '' 2011/7/3 José Luis Redrejo Rodríguez > startswith and endswith are not supported in GAE either > > 2011/7/3 Bruno Rocha : > > I dont know about autocomplete widget, but, for 'like' in GAE you can use > > Row.find() > > > > term = "something" > > pages = db(db.table.id>0).select().find(lambda row : > > row.field.startswith(term) or row.field.endswith(term) or row.field == > term > > or term in row.field) > > > > On Sun, Jul 3, 2011 at 12:53 PM, José L. wrote: > >> > >> I've checked autocomplete widget can not work in gae, as it uses like in > >> its callback. > >> Checking this group archives, I've found this > >> thread: https://groups.google.com/d/topic/web2py/HdnWTp7h3Do/discussion > >> but even if it looks like it would work, finally it was not implemented. > >> So, does anybody know of any workaround to make autocomplete work in > GAE? > >> BTW: A note should be added at the web2py book section > >> (http://www.web2py.com/book/default/chapter/07#Autocomplete-Widget ) > warning > >> it does not work in gae. It will save time to many people. > >> Regards. > >> José L. > > > > > > -- > > > > > > > > -- > > Bruno Rocha > > [ About me: http://zerp.ly/rochacbruno ] > > [ Aprenda a programar: http://CursoDePython.com.br ] > > [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] > > [ Consultoria em desenvolvimento web: http://www.blouweb.com ] > > > -- -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
[web2py] Re: question about count()
Thanks Bruno for the response. Yes, that's what I do -- I almost never use ALL unless I really need it. I'm into minimal overhead at ALL times. On Jul 3, 12:20 pm, Bruno Rocha wrote: > the only argument you can pass to count() is a fieldname, so it will count > using DISTINCT > > >>> db(db.products.id>0)._count('id') > > 'SELECT count(DISTINCT id) FROM products WHERE (products.id > 0)' > > Left Joins are Row objects, so this object is a fetched rows from database, > there no way (that I know) to do a left join in a Query or Set objects. > > len(db().select(.)) # seems to be the only way. > > To minimize the db charge, do the counte by less columns not using .ALL (*) > > total = len(db().select(db.products.id, > db.orders.id, > left=db.orders.on(db.products.id== > db.orders.id) > ) > ) > > On Sun, Jul 3, 2011 at 12:32 PM, weheh wrote: > > To the best of my knowledge, count() doesn't take an argument, such as > > left. I would like to be proven wrong. If so, then how do we count if > > there's a left join, except by doing a select and then a > > len(db(query).select(...left=[...]))? Seems like it should be able to > > do db(query).count(left=[...]). > > -- > > -- > Bruno Rocha > [ About me:http://zerp.ly/rochacbruno] > [ Aprenda a programar:http://CursoDePython.com.br] > [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br] > [ Consultoria em desenvolvimento web:http://www.blouweb.com]
[web2py] Re: problem with gae deployment
in ubuntu 10.x is working but in ubuntu 11.4 its giving some error. ok i'll check it out once again. On Jun 1, 8:10 am, dhmorgan wrote: > check to see whether the command you indicated: > > $ /home/ramkrishan/Downloads/Python-2.5.5/./python > > is running 2.6 or 2.5.5 > > not sure what the effect of the "/./" would be on your installation; > the error is indicative of Python 2.6, which may be what is getting > run; > > with Ubuntu 10.x, you may wish to get the 'Dead Snakes' branch of > Python 2.5.5 from Launchpad; once installed, you can run it from > anywhere with 'python2.5' > > On Jun 1, 7:14 am, ramkrishan bhatt > wrote: > > > > > > > > > $ cd workspace/Running\ Project/ > > ramkrishan@ramkrishan-Aspire-5740:~/workspace/Running Project$ > > /home/ramkrishan/Downloads/Python-2.5.5/./python > > google_appengine/dev_appserver.py coporategift/web2py/ > > Traceback (most recent call last): > > File "google_appengine/dev_appserver.py", line 76, in > > run_file(__file__, globals()) > > File "google_appengine/dev_appserver.py", line 72, in run_file > > execfile(script_path, globals_) > > File "/home/ramkrishan/workspace/Running > > Project/google_appengine/google/appengine/tools/dev_appserver_main.py", line > > 146, in > > from google.appengine.tools import appcfg > > File "/home/ramkrishan/workspace/Running > > Project/google_appengine/google/appengine/tools/appcfg.py", line 69, in > > > > from google.appengine.tools import appengine_rpc > > File "/home/ramkrishan/workspace/Running > > Project/google_appengine/google/appengine/tools/appengine_rpc.py", line 27, > > in > > import fancy_urllib > > File "/home/ramkrishan/workspace/Running > > Project/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line > > 341, in > > class FancyHTTPSHandler(urllib2.HTTPSHandler): > > AttributeError: 'module' object has no attribute 'HTTPSHandler' > > > please tell me the solution ... i am using ubuntu 10.10
[web2py] email and html
I'm sending email with html message body. Problem is, html doesn't seem to be working. I'm trying to inline an tag and an text link but neither of them is displaying properly in Thunderbird, my email client. On a 2nd note, I am also testing out the mail.send(..., message=('plain text message','html message')). In this case, the html message does not render, same as before. But also, when I put Thunderbird in the mode to show only plain text, there is no plain text message either. Anybody have some guidance? Thanks.
[web2py] Re: question about count() [closed]
On Jul 3, 12:20 pm, Bruno Rocha wrote: > the only argument you can pass to count() is a fieldname, so it will count > using DISTINCT > > >>> db(db.products.id>0)._count('id') > > 'SELECT count(DISTINCT id) FROM products WHERE (products.id > 0)' > > Left Joins are Row objects, so this object is a fetched rows from database, > there no way (that I know) to do a left join in a Query or Set objects. > > len(db().select(.)) # seems to be the only way. > > To minimize the db charge, do the counte by less columns not using .ALL (*) > > total = len(db().select(db.products.id, > db.orders.id, > left=db.orders.on(db.products.id== > db.orders.id) > ) > ) > > On Sun, Jul 3, 2011 at 12:32 PM, weheh wrote: > > To the best of my knowledge, count() doesn't take an argument, such as > > left. I would like to be proven wrong. If so, then how do we count if > > there's a left join, except by doing a select and then a > > len(db(query).select(...left=[...]))? Seems like it should be able to > > do db(query).count(left=[...]). > > -- > > -- > Bruno Rocha > [ About me:http://zerp.ly/rochacbruno] > [ Aprenda a programar:http://CursoDePython.com.br] > [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br] > [ Consultoria em desenvolvimento web:http://www.blouweb.com]
[web2py] Re: email and html
Can you look at the raw message to see if you can spot any problems?
[web2py] Error on Displaying Image from Custom URL
Here is My Model db.define_table('img', timestamp, Field('caption','string', length=1000, requires=[IS_LENGTH(1000)]), Field('upload', 'upload', requires=[IS_LENGTH(20)], uploadfolder=os.path.join(request.folder, 'uploads','images','general')) ) To Display I've tried: But they all give me the same error:
[web2py] Re: Error on Displaying Image from Custom URL
I accidently clicked "Send". More info to come soon. On Jul 3, 12:50 pm, Lennon wrote: > Here is My Model > > db.define_table('img', timestamp, > Field('caption','string', length=1000, > requires=[IS_LENGTH(1000)]), > Field('upload', 'upload', requires=[IS_LENGTH(20)], > uploadfolder=os.path.join(request.folder, > 'uploads','images','general')) > ) > > To Display I've tried: > > > > > > But they all give me the same error:
[web2py] Re: Error on Displaying Image from Custom URL
In the DB the upload field looks like this which I think could be part of the problem: FieldStorage('upload', 'Mars.jpg', '\xff\xd8\xff\xe0\x00\x10JFIF \x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xfe\x00>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality\n\xff\xdb\x00C \x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c \x0b\x0b\x0c\x19\x12\x13\x0f\x14\x1d\x1a\x1f\x1e\x1d\x1a\x1c\x1c $.\' ",#\x1c\x1c(7),01444\x1f\'9=82<.342\xff\xdb\x00C\x01\t\t\t\x0c\x0b\x0c \x18\r\r\x182!\x1c! 22\xff \xc0\x00\x11\x08\x00d\x00K\x03\x01"\x00\ The error looks like this: Traceback (most recent call last): File "C:\Users\Lennon\workspace\web2py_source\gluon\restricted.py", line 186, in restricted ccode = compile2(code,layer) File "C:\Users\Lennon\workspace\web2py_source\gluon\restricted.py", line 173, in compile2 return compile(code.rstrip().replace('\r\n','\n')+'\n', layer, 'exec') File "C:\Users\Lennon\workspace\web2py_source\applications\sos_test/ views\default/trip_type.html", line 368 response.write('" alt="', escape=False) ^ SyntaxError: invalid syntax On Jul 3, 12:50 pm, Lennon wrote: > Here is My Model > > db.define_table('img', timestamp, > Field('caption','string', length=1000, > requires=[IS_LENGTH(1000)]), > Field('upload', 'upload', requires=[IS_LENGTH(20)], > uploadfolder=os.path.join(request.folder, > 'uploads','images','general')) > ) > > To Display I've tried: > > > > > > But they all give me the same error:
[web2py] Re: Error on Displaying Image from Custom URL
I would suggest following the Book more closely: http://web2py.com/book/default/chapter/03 db.define_table('image', Field('caption'), Field('file', 'upload'))
[web2py] Re: email and html [closed]
Curious, got it working, now. Not sure what changed, exactly. Thanks @pbreit for the response.
[web2py] Decrypt Passwords.
I was wondering how I could decrypt the passwords in my DB? I want to change me auth.settings.hmac_key but if I do that then existing users wont be able to login so I thought if I could decrypt and then encrypt using the new key my problems would be solved. Thanks. David.
[web2py] Re: Decrypt Passwords.
They are one-way hashed and thus not decryptable. What is typically done in this situation is 1) everyone has to re-generate a password (not ideal) or 2) begin using the new scheme and continue to accept old passwords for some period of time. I'm not exactly sure how #2 would be accomplished in Web2py. I am looking into that as well as figuring out how to implement bcrypt since there seems to be a lot of conversation about password security these days (http://news.ycombinator.org/item?id=2716714).
Re: [web2py] Re: Decrypt Passwords.
Thanks; Not exactly the answer I was looking for :) On 7/3/11 1:43 PM, pbreit wrote: They are one-way hashed and thus not decryptable. What is typically done in this situation is 1) everyone has to re-generate a password (not ideal) or 2) begin using the new scheme and continue to accept old passwords for some period of time. I'm not exactly sure how #2 would be accomplished in Web2py. I am looking into that as well as figuring out how to implement bcrypt since there seems to be a lot of conversation about password security these days (http://news.ycombinator.org/item?id=2716714).
[web2py] Re: Error on LOAD() in trunk
00 Preface "whilst always maintaining backward compatibility" Please, return previous ajax=False functionality (with passing current request to all LOAD(ajax=False) functions). It's a really important feature for component development. I have 2 sites broken because of it. =\ On 3 июл, 08:45, pbreit wrote: > I also use LOAD(ajax=False) in emails and am not sure how well ajax=True > would work in various email clients.
[web2py] Re: Error on LOAD() in trunk
For now, you can revert back to changeset d4c2d8d15bb1 although I'm not sure if that will cause other problems.
[web2py] fcgihandler.py and pid file
Greetings, I'm trying to use the web2py.ubuntu.sh script, but am having a little trouble. I use fcgihandler.py with lighttpd. I changed the DAEMON_ARGS line to say fcgihandler.py instead of web2py.py, and it will start the web2py instance successfully. But, it doen't seem to make a pid file, so running the init script with the 'stop' or 'restart' options doesn't do anything. Any suggestions? I played around with the name of the argument a bit, but no joy. I even created an options.py and set just the pid_filename, no joy. -- Andrew Thompson http://aktzero.com/
[web2py] Re: Error on Displaying Image from Custom URL
UPDATE: The error I was getting was caused by a missing ')' in the view so fixing that has gotten me to a new error. I simplified my model to how you have pbreit just to make things easier. But when I try to display the image like so: I get a 400 error in the Chrome Console: http://127.0.0.1:8000/sos_test/default/download/FieldStorage%28%27upload%27%2C%20%27Mars.jpg%27%2C%20%27%5Cxff%5Cxd8%5Cxff%5Cxe0%5Cx00%5Cx10JFIF%5Cx00%5Cx01%5Cx01%5Cx00%5Cx00%5Cx01%5Cx00%5Cx01%5Cx00%5Cx00%5Cxff%5Cxfe%5Cx00%3ECREATOR%3A%20gd-jpeg%20v1.0%20%28using%20IJG%20JPEG%20v62%29%2C%20default%20quality%5Cn%5Cxff%5Cxdb%5Cx00C%5Cx00%5Cx08%5Cx06%5Cx06%5Cx07%5Cx06%5Cx05%5Cx08%5Cx07%5Cx07%5Cx07%5Ct%5Ct%5Cx08%5Cn%5Cx0c%5Cx14%5Cr%5Cx0c%5Cx0b%5Cx0b%5Cx0c%5Cx19%5Cx12%5Cx13%5Cx0f%5Cx14%5Cx1d%5Cx1a%5Cx1f%5Cx1e%5Cx1d%5Cx1a%5Cx1c%5Cx1c%20%24.%5C%27%20%22%2C%23%5Cx1c%5Cx1c%287%29%2C01444%5Cx1f%5C%279%3D82%3C.342%5Cxff%5Cxdb%5Cx00C%5Cx01%5Ct%5Ct%5Ct%5Cx0c%5Cx0b%5Cx0c%5Cx18%5Cr%5Cr%5Cx182%21%5Cx1c%2122%5Cxff%5Cxc0%5Cx00%5Cx11%5Cx08%5Cx00d%5Cx00K%5Cx03%5Cx01%22%5Cx00%5C 400 (BAD REQUEST) There is that field storage again. I tried doing img['upload'].filename as recommended in this link: http://groups.google.com/group/web2py/browse_thread/thread/9562da3b8bfb4c96/5cf5dca2885e473c?lnk=gst&q=How+to+retrieve+data+from+FieldStorage#5cf5dca2885e473c But I got an error that the object was a string and .fieldname wouldn't work. Thoughts? I'm using SQLForm to upload the image. Maybe I'm doing something strange upon upload to store it in such a weird format? On Jul 3, 1:04 pm, pbreit wrote: > I would suggest following the Book more > closely:http://web2py.com/book/default/chapter/03 > > db.define_table('image', > Field('caption'), > Field('file', 'upload')) > >
[web2py] Re: Error on LOAD() in trunk
say please how to do it, thx On 4 июл, 00:01, pbreit wrote: > For now, you can revert back to changeset d4c2d8d15bb1 although I'm not sure > if that will cause other problems.
[web2py] Re: Error on Displaying Image from Custom URL
You managed to bypass the web2py upload mechanism and stored a FieldStorage object in the database. This is a mistake because it is difficult to take it out. The problem is probably not in your model but in the form you use to populate. Can you show us the action? On Jul 3, 2:29 pm, Lennon wrote: > UPDATE: > > The error I was getting was caused by a missing ')' in the view so > fixing that has gotten me to a new error. > > I simplified my model to how you have pbreit just to make things > easier. > > But when I try to display the image like so: > > > > I get a 400 error in the Chrome Console: > > http://127.0.0.1:8000/sos_test/default/download/FieldStorage%28%27upl... > 400 (BAD REQUEST) > > There is that field storage again. I tried doing > img['upload'].filename as recommended in this link: > > http://groups.google.com/group/web2py/browse_thread/thread/9562da3b8b... > > But I got an error that the object was a string and .fieldname > wouldn't work. > > Thoughts? > > I'm using SQLForm to upload the image. Maybe I'm doing something > strange upon upload to store it in such a weird format? > > On Jul 3, 1:04 pm, pbreit wrote: > > > > > > > > > I would suggest following the Book more > > closely:http://web2py.com/book/default/chapter/03 > > > db.define_table('image', > > Field('caption'), > > Field('file', 'upload')) > > >
[web2py] Re: Error on LOAD() in trunk
I do not have an objection to fix but I need to understand better what is broken. If the problem with the latest stable or with trunk too? On Jul 3, 12:59 pm, LightOfMooN wrote: > 00 Preface > "whilst always maintaining backward compatibility" > > Please, return previous ajax=False functionality (with passing current > request to all LOAD(ajax=False) functions). > It's a really important feature for component development. > I have 2 sites broken because of it. =\ > > On 3 июл, 08:45, pbreit wrote: > > > > > > > > > I also use LOAD(ajax=False) in emails and am not sure how well ajax=True > > would work in various email clients.
[web2py] Re: Error on Displaying Image from Custom URL
Here is the form. I'm also using a custom uploader which is probably where the problem is: UPLOADER: def img_upload_widget(f,v, u): inp = SQLFORM.widgets.upload.widget(f,v, u) img_url = URL('default','download', args=v) img = IMG(_src=img_url, _style='max-width:350px;max-height:350px') return DIV(img, BR(), inp) if v else inp FORM: def edit_item(): is_admin() print 'edit item' for k in ('t','item_id', 'form_id'): if not k in request.vars: return else: globals()[k] = request.vars[k] globals()['item_id'] = int(item_id) #get record by id record = db[t](item_id) if not record:return "Error: Record not found" #create form form = SQLFORM(db[t],record, _id=form_id, _class='admin-form edit- form') #submit data if form.accepts(request.vars, formname=None): update_grid_cache(t) return "success" elif form.errors: return form On Jul 3, 4:23 pm, Massimo Di Pierro wrote: > You managed to bypass the web2py upload mechanism and stored a > FieldStorage object in the database. This is a mistake because it is > difficult to take it out. The problem is probably not in your model > but in the form you use to populate. Can you show us the action? > > On Jul 3, 2:29 pm, Lennon wrote: > > > > > > > > > UPDATE: > > > The error I was getting was caused by a missing ')' in the view so > > fixing that has gotten me to a new error. > > > I simplified my model to how you have pbreit just to make things > > easier. > > > But when I try to display the image like so: > > > > > > I get a 400 error in the Chrome Console: > > >http://127.0.0.1:8000/sos_test/default/download/FieldStorage%28%27upl... > > 400 (BAD REQUEST) > > > There is that field storage again. I tried doing > > img['upload'].filename as recommended in this link: > > >http://groups.google.com/group/web2py/browse_thread/thread/9562da3b8b... > > > But I got an error that the object was a string and .fieldname > > wouldn't work. > > > Thoughts? > > > I'm using SQLForm to upload the image. Maybe I'm doing something > > strange upon upload to store it in such a weird format? > > > On Jul 3, 1:04 pm, pbreit wrote: > > > > I would suggest following the Book more > > > closely:http://web2py.com/book/default/chapter/03 > > > > db.define_table('image', > > > Field('caption'), > > > Field('file', 'upload')) > > > >
[web2py] Re: Error on Displaying Image from Custom URL
I'm doing it it through AJAX so it's broken up into add_form and add_item. Let me know if you need any clarification or additional code. add_form: def add_form(): is_admin() if not 't' in request.vars: return else: for k in ('t', 'pid', 'ptype'): globals()[k] = request.vars[k] if k in request.vars else None if pid: globals()['pid'] = int(pid) fields = db[t].fields if ptype and (ptype + '_id') in fields: fields.remove((ptype +'_id')) form_id = '%s-create-%i' % (t, random.randint(0,)) url_vars = dict(t=t, form_id=form_id) if pid and ptype: url_vars.update(pid=pid, ptype=ptype) url = adminc('add_item', vars=url_vars) form = SQLFORM(db[t], fields = fields, _id=form_id, _class='admin- form add-form', _action=url) disambiguate_form_datetime_ids(form, t) ret = dict(create_form = form, t=t, create_form_id=form_id, lbl = ADMIN_TYPES_INDEX[t]['lbl']) if ptype and pid: ret.update(ptype=ptype,pid=pid, plbl=get_item_lbl(ptype,pid)) return ret add_item: def add_item(): is_admin() if not 't' in request.vars: return else: for k in ('t', 'pid', 'ptype','form_id'): globals()[k] = request.vars[k] if k in request.vars else None if pid and pid != 'undefined': globals()['pid'] = int(pid) #process join/m2m fields = db[t].fields if ptype: if pid and (ptype + '_id') in fields: request.vars[ptype + '_id'] = pid m2m = False else: subtab = ADMIN_TYPES_INDEX[ptype]['subtab_types_index'][t] m2m = 'm2m' in subtab and subtab['m2m'] m2m_table = get_m2m(t,ptype) else: m2m = False #create form url_vars = dict(t=t, form_id=form_id) if pid and ptype: url_vars.update(pid=pid, ptype=ptype) url = adminc('add_item', vars=url_vars) form = SQLFORM(db[t], _class = 'admin-form add-form', _id=form_id, _action=url) cleanvars = db[t]._filter_fields(request.vars)#dict( (k, request.vars[k]) for k in request.vars if k in fields) #check for preinsert hook hooks = CRUD_HOOKS[t] if t in CRUD_HOOKS else None if hooks and 'preinsert' in hooks: res = hooks['preinsert'](t,cleanvars,ptype,pid) if res and isinstance(res,str) and 'Error' in res: return res elif res: cleanvars = res #submit data if form.accepts(cleanvars, formname=None, dbio = not m2m): cache_update = [t] if m2m: id = db[t].insert(**cleanvars) join_table = m2m_table or (ptype + 's_' + t + 's') join_ins = { (t + '_id'):id, (ptype + '_id'):pid } join_ins.update(dict((k, request.vars[k]) for k in request.vars if k not in cleanvars and k in db[join_table].fields)) db[join_table].insert(**join_ins) cache_update.append(join_table) update_grid_cache(*cache_update) print 'inserted' return "success" elif form.errors: return form On Jul 3, 4:23 pm, Massimo Di Pierro wrote: > You managed to bypass the web2py upload mechanism and stored a > FieldStorage object in the database. This is a mistake because it is > difficult to take it out. The problem is probably not in your model > but in the form you use to populate. Can you show us the action? > > On Jul 3, 2:29 pm, Lennon wrote: > > > > > > > > > UPDATE: > > > The error I was getting was caused by a missing ')' in the view so > > fixing that has gotten me to a new error. > > > I simplified my model to how you have pbreit just to make things > > easier. > > > But when I try to display the image like so: > > > > > > I get a 400 error in the Chrome Console: > > >http://127.0.0.1:8000/sos_test/default/download/FieldStorage%28%27upl... > > 400 (BAD REQUEST) > > > There is that field storage again. I tried doing > > img['upload'].filename as recommended in this link: > > >http://groups.google.com/group/web2py/browse_thread/thread/9562da3b8b... > > > But I got an error that the object was a string and .fieldname > > wouldn't work. > > > Thoughts? > > > I'm using SQLForm to upload the image. Maybe I'm doing something > > strange upon upload to store it in such a weird format? > > > On Jul 3, 1:04 pm, pbreit wrote: > > > > I would suggest following the Book more > > > closely:http://web2py.com/book/default/chapter/03 > > > > db.define_table('image', > > > Field('caption'), > > > Field('file', 'upload')) > > > >
[web2py] Re: Error on Displaying Image from Custom URL
Disregard my last post. On Jul 3, 5:28 pm, Lennon wrote: > Here is the form. I'm also using a custom uploader which is probably > where the problem is: > > UPLOADER: > > def img_upload_widget(f,v, u): > inp = SQLFORM.widgets.upload.widget(f,v, u) > img_url = URL('default','download', args=v) > img = IMG(_src=img_url, _style='max-width:350px;max-height:350px') > return DIV(img, BR(), inp) if v else inp > > FORM: > > def edit_item(): > is_admin() > print 'edit item' > > for k in ('t','item_id', 'form_id'): > if not k in request.vars: > return > else: globals()[k] = request.vars[k] > > globals()['item_id'] = int(item_id) > > #get record by id > record = db[t](item_id) > if not record:return "Error: Record not found" > > #create form > form = SQLFORM(db[t],record, _id=form_id, _class='admin-form edit- > form') > > #submit data > if form.accepts(request.vars, formname=None): > update_grid_cache(t) > return "success" > elif form.errors: > return form > > On Jul 3, 4:23 pm, Massimo Di Pierro > wrote: > > > > > > > > > You managed to bypass the web2py upload mechanism and stored a > > FieldStorage object in the database. This is a mistake because it is > > difficult to take it out. The problem is probably not in your model > > but in the form you use to populate. Can you show us the action? > > > On Jul 3, 2:29 pm, Lennon wrote: > > > > UPDATE: > > > > The error I was getting was caused by a missing ')' in the view so > > > fixing that has gotten me to a new error. > > > > I simplified my model to how you have pbreit just to make things > > > easier. > > > > But when I try to display the image like so: > > > > > > > > I get a 400 error in the Chrome Console: > > > >http://127.0.0.1:8000/sos_test/default/download/FieldStorage%28%27upl... > > > 400 (BAD REQUEST) > > > > There is that field storage again. I tried doing > > > img['upload'].filename as recommended in this link: > > > >http://groups.google.com/group/web2py/browse_thread/thread/9562da3b8b... > > > > But I got an error that the object was a string and .fieldname > > > wouldn't work. > > > > Thoughts? > > > > I'm using SQLForm to upload the image. Maybe I'm doing something > > > strange upon upload to store it in such a weird format? > > > > On Jul 3, 1:04 pm, pbreit wrote: > > > > > I would suggest following the Book more > > > > closely:http://web2py.com/book/default/chapter/03 > > > > > db.define_table('image', > > > > Field('caption'), > > > > Field('file', 'upload')) > > > > >
[web2py] Re: Error on LOAD() in trunk
For me, the problem seems to be this changeset: http://code.google.com/p/web2py/source/detail?r=143bbe9e11c1c66f6d932514c9918ad7410027b5 Light, if you are cloning Web2py with Mercurial (which is a good idea), you can specify exactly which version you want to be running like this: $ hg update [changeset] So to set Web2py back to a version that works: $ hg update d4c2d8d15bb1
[web2py] URGENT: help needed with Auth and Facebook data
Hi all, I am trying to incorporate Facebook's registration plugin into a webapp I am developing but I am stuck at a point and need some clarifications on how Auth in web2py really works. First of all, I have been able to connect to facebook and retrieve signed data about users from it. I have also been able to decoded the signed data and the result is a JSON hash. Now I am stuck on how to insert this data into my db.auth_user table in the case of "registration" and comparing my facebook data with what is in db.auth_user table in the case of "login". I would really like to know how to call the login or register methods of the auth class and pass in the facebook data without submitting it through the default form presented by going to "application/default/ user". Also can I do a manual insert insert and do: auth.user = myfacebookdata["username"] ? will the user become logged in? and will all my auth functions work? I hope my question is clear enough? and if its not, I will be happy to clarify what I want to do exactly. Thanks Pystar
[web2py] plupload and web2py
I just spent the last hour tracking down a conflict between plupload and web2py. Long story short: plupload.flash.js tags a div with a secondary class 'flash' which web2py hides inadvertently in base.css, thereby disabling the flash functionality of plupload. Just wanted to document this in case it helps someone and also recommend that the web2py 'flash' div be renamed to web2py_flash.
[web2py] Re: plupload and web2py
Notice that flash is only used in views/layout.html, views/ web2py_ajax.html and static/js/web2py_ajax.js You can replace class "flash" it with class "web2py-ajax" and it should fix the problem. On Jul 3, 9:04 pm, "mr.freeze" wrote: > I just spent the last hour tracking down a conflict between plupload > and web2py. Long story short: plupload.flash.js tags a div with a > secondary class 'flash' which web2py hides inadvertently in base.css, > thereby disabling the flash functionality of plupload. Just wanted to > document this in case it helps someone and also recommend that the > web2py 'flash' div be renamed to web2py_flash.
[web2py] Re: URGENT: help needed with Auth and Facebook data
I wouldn't mind seeing an overview of how to code a third party registration/login. I'm considering doing it for Facebook, Twitter, LinkedIn, Ebay and PayPal but can't make heads or tales of the information I've seen so far. I have no interest in using Janrain.
[web2py] Re: URGENT: help needed with Auth and Facebook data
Massimo and I are working on it. More on this later. On Jul 4, 3:22 am, pbreit wrote: > I wouldn't mind seeing an overview of how to code a third party > registration/login. I'm considering doing it for Facebook, Twitter, > LinkedIn, Ebay and PayPal but can't make heads or tales of the information > I've seen so far. I have no interest in using Janrain.
[web2py] Re: crud.search query
Bump. Anyone? On Jul 1, 7:24 pm, niknok wrote: > I have field "gender" that is defined like so: > > Field('gender','reference aux_gender',notnull=True,widget=radio_h) > > The aux_gender table data were inserted from: > > db.aux_gender.insert(code='F',concept='Female') > db.aux_gender.insert(code='M',concept='Male') > > I have a view that uses crud.search but couldn't search for records on > gender field. Tried using record id (since they're saved as integers in > database) but it doesn't produce any search results. Also tried "M", and > "F" to no avail. > > What am I doing wrong here? > > /r > Nik > > w2p gender bender.png > 134KViewDownload > > w2p gender bender results.png > 59KViewDownload
[web2py] Re: crud.search query
I do not know. Try experiment some more or send me the app and I will take a look. On Jul 3, 10:02 pm, niknok wrote: > Bump. Anyone? > > On Jul 1, 7:24 pm, niknok wrote: > > > > > > > > > I have field "gender" that is defined like so: > > > Field('gender','reference aux_gender',notnull=True,widget=radio_h) > > > The aux_gender table data were inserted from: > > > db.aux_gender.insert(code='F',concept='Female') > > db.aux_gender.insert(code='M',concept='Male') > > > I have a view that uses crud.search but couldn't search for records on > > gender field. Tried using record id (since they're saved as integers in > > database) but it doesn't produce any search results. Also tried "M", and > > "F" to no avail. > > > What am I doing wrong here? > > > /r > > Nik > > > w2p gender bender.png > > 134KViewDownload > > > w2p gender bender results.png > > 59KViewDownload
[web2py] Re: regarding "http://mdp.cti.depaul.edu/"
Oh ! I saw that link in old threads. Did not know that it is the predecessor of http://www.web2py.com Sorry for that. On Jul 2, 7:23 pm, Massimo Di Pierro wrote: > Where is that link? That was replaced byhttp://web2py.commore than 3 > years ago. > > On Jul 2, 7:56 am, Vineet wrote: > > > > > I was trying to see this link--http://mdp.cti.depaul.edu/ > > Is this link broken? > > I could not access it.- Hide quoted text - > > - Show quoted text -
[web2py] Re: pyodbc access to Teradata (via web2py)
Hi Massimo, Have you been able to look into creating a Teradata Adaptor ? Thanks and Regards Andrew
[web2py] Re: pyodbc access to Teradata (via web2py)
I added but did not try. Get trunk and try something like: db=DAL('teradata://DRIVER{Teradata};DBCNAME=10.10.10.10; UID=test123;PWD=xxx;QUIETMODE=YES;') Look into dal.py TeradataAdapter.__init__ I assumed the SQL is DB2 compatible but I am sure there are exceptions. On Jul 3, 11:33 pm, Andrew wrote: > Hi Massimo, > > Have you been able to look into creating a Teradata Adaptor ? > > Thanks and Regards > > Andrew
[web2py] patches on google code
If you submitted a patch or new info in one of the old issues in google code, please remind me. I am not ignoring it, just find hard to keep track. Massimo
[web2py] talks
I am giving two talks in California next week (July 7 at LBL) and the week after (July 13 at Python Users Group). Let me know if some of you will be there. I can send more details as they tell me. Massimo