[web2py] Re: Too many redirects when trying to use interactive demo
Hi! I'm having problem with web2py.com/demo_admin. Tried it on a Windows XP SP3 with FF 9.0.1 and IE 8 regards Gerd
[web2py] Re: new book now available in HTML (english, japanese, italian)
Stefan Scholl ste...@no-spoon.de wrote: Johann Spies johann.sp...@gmail.com wrote: [-- text/plain, encoding 7bit, charset: ISO-8859-1, 8 lines --] It is working for me. Perhaps you should try again. Nope, still gone. When I look at the response header I see it's a 404 NOT FOUND. http://web2py.com/book/ instead of http://web2py.com/book See the additional /, which worked before. I still think this is embarrassing.
[web2py] Re: [off topic] Announcement
On Wed, 18 Jan 2012 21:26:48 -0500 Richard Vézina ml.richard.vez...@gmail.com wrote: Hello Everybody, I just would like to announce that Mathilde is born the 8 of january. I will be away from my computer a few more weeks... Congratulation and enjoy your fathership- ;) Sincerely, Gour -- As a strong wind sweeps away a boat on the water, even one of the roaming senses on which the mind focuses can carry away a man's intelligence. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 signature.asc Description: PGP signature
[web2py] Re: Postgres unknown reference field type
Fixed. +1 to Massimo although it wasn't this error, but one lower down in the list. First error was failure to add a 'requires' constraint to pair with the db.Client. Thanks, was too tired to spot these. On Jan 19, 1:58 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: from the error looks like you have Field('Client', 'db.Client'), instead of Field('Client', db.Client), is that possible? On Jan 18, 6:25 pm, Simon Ashley gregs...@gmail.com wrote: Moving from SQLite to Postgres and when running Database Administration we're getting unknown field type errors when using a db reference i.e. Field('Client', db.Client) Any advice or work arounds? TIA, Traceback (most recent call last): File C:\web2py\gluon\restricted.py, line 204, in restricted exec ccode in environment File C:/web2py/applications/OAS/models/oa.py, line 358, in module Field('Interpretation_Type', db.Interpretation_Type)) File C:\web2py\gluon\dal.py, line 5114, in define_table polymodel=polymodel) File C:\web2py\gluon\dal.py, line 624, in create_table (field.type, field.name) SyntaxError: Field: unknown field type: db.Client for Client Code listing: precision, scale = map(int,field.type[8:-1].split(',')) ftype = self.types[field.type[:7]] % \ dict(precision=precision,scale=scale) elif not field.type in self.types: raise SyntaxError, 'Field: unknown field type: %s for %s' % \ (field.type, field.name) Model: db.define_table('Client', Field('Company', 'string'), Field('Address', 'string'), Field('Town', 'string'), Field('State', 'string'), Field('Zip', 'string'), Field('Activity', 'integer'), Field('Account', 'integer'), format='%(Company)s') db.define_table('Contact', Field('Client', db.Client), Field('Surname', 'string'), Field('First_Name', 'string'), Field('Position', 'string'), Field('Department', 'string'), Field('eMail', 'string'), Field('Mobile', 'string'), Field('Phone', 'string'), Field('Fax', 'string'), format='%(Surname)s - %(First_Name)s') Environment: Windows 7 64bit Current Postgresql (64bit) with psycopy2 web2py source from trunk: (1, 99, 4, datetime.datetime(2011, 12, 31, 4, 51, 15), 'stable') Python 2.7.2: C:\Python27\python.exe
[web2py] login with blank password:problem
Hi , i am developing an online booking system in web2py on GAE. The problem that i am facing is when i create an entity (client/ volunteer/employee) in my system , i store a random password in the db (auth_random_password()) and 'pending' in the registration key initially. but when i enable the login (registration_key = ) for an entity. i can login the system without typing anything in the password field. also if i do request_reset_password then the login functionality is working absolutely fine.(email as well as password is required after request_reset_password ) is it neccessary that when ever an entity (client/employee/volunteer) is created that we must do a request reset password in order for login functionality to work properly (with email and valid password) Is there any solution to avoid this ? Please suggest on this Thanks in advance.
[web2py] Re: string not recognized
Thank you for the reply. I ran into the situation because I wanted to copy the raw wikipedia markup of a wikipedia page, which does use {{. I had trouble copying the browser formatted page. Possibly, there could be a special tag for that. Since the view accepts Python code, there is probably a nice work around. I will try some things and submit a hopefully clean suggestion. On Jan 18, 6:46 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Because the {{ }} operator have precedence over everything else. when web2py finds {{=PRE({{this is a string}}))} interprets it as OPEN{{ =PRE({{this is a string CLOSE}} ))} when you want to put and in HTML you have to escape them with lt; and gt; similarly if you want to put {{ and }} inside web2py views you have to escape them. In your case the simples solution is: {{=PRE({+{this is a string}+}))} On Jan 18, 7:59 am, davidjensen davidjensen...@gmail.com wrote: It bombs onPRE,CODE, and nowXML On Jan 18, 3:13 am, nils n...@olofsson.tv wrote: Hi, Could you not use {{=XML(string...)}} Regards, Nils On Jan 18, 2012 9:43 a.m., davidjensen davidjensen...@gmail.com wrote: This is not recognized asa string: {{this is a string}} in: {{=PRE({{this is a string}}))} in a web page but it works on the command line: PRE({{this is a string}}).xml()
[web2py] Re: sqlhtml unicode error
I found that the Unicode errors are originated because of incompatible encodings when web2py tries to read the raw message and render the data for browser output. I solved it encoding the RFC822 raw text before parsing the response data as Rows. Still i am not sure if this is the correct way for processing the response text so it can be sent safely (without misread characters) to the user interface. Anyway, it seems to work well, without instensive testing. On 18 ene, 18:40, Alan Etkin spame...@gmail.com wrote: I am trying to generate sqltables with the experimental IMAPAdapter select output, but with some rows, an exception is raised at the sqlhtml module. It has to do with unicode and charsets when sqlhtml processes the rows object returned by the adapter's select method, but I cannot find a proper way of solving it. Here is the error trace: Traceback (most recent call last): File /home/alan/web2py-hg/gluon/restricted.py, line 204, in restricted exec ccode in environment File /home/alan/web2py-hg/applications/queries/views/default/ index.html, line 126, in module File /home/alan/web2py-hg/gluon/globals.py, line 181, in write self.body.write(xmlescape(data)) File /home/alan/web2py-hg/gluon/html.py, line 114, in xmlescape return data.xml() File /home/alan/web2py-hg/gluon/dal.py, line 7442, in xml return sqlhtml.SQLTABLE(self).xml() File /home/alan/web2py-hg/gluon/sqlhtml.py, line 2197, in __init__ ur = unicode(r, 'utf8') File /usr/lib/python2.6/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1227-1229: invalid data I found a workaround to avoid the exception but I doubt it's the correct fix, because it just prevents web2py to create the unicode object and use the raw input instead. This is the workaround: (gluon/sqlhtml.py Line 2196) try: ur = unicode(r, 'utf-8') except UnicodeDecodeError, e: ur = r Replacing this line: ur = unicode(r, 'utf8') When creating the Row objects at the adapter, I have to handle different encodings depending on the message. What would be an appropiate way of encoding data before creating the Row objects, so unicode errors can be avoided? This is the adapter method i am using to store the parse input for each text field def encode_text(self, text, charset, errors=replace): convert text for mail to unicode if text is None: text = else: if charset is not None: text = unicode(text, charset, errors) else: text = unicode(text, utf-8, errors) return text Thanks I am using the last source hg version (1.99.4) with Python 2.6.5 on a Mandriva GNU/Linux machine.
[web2py] Integration with OpenID, Facebook
Dear All, I am using the Integration with OpenID, Facebook from the book , now what i want to do is to get users images from facebook and anyother accounts that use to register , so any ideas ?
[web2py] bitcoin
I like to support web2py project with bitcoin (http://bitcoin.org/). Can I send you this currency ? btcgriffin
[web2py] Re: Announcement
Congratulations, Richard. All the best to your family. On Jan 19, 3:38 am, Gour g...@atmarama.net wrote: On Wed, 18 Jan 2012 21:26:48 -0500 Richard Vézina ml.richard.vez...@gmail.com wrote: Hello Everybody, I just would like to announce that Mathilde is born the 8 of january. I will be away from my computer a few more weeks... Congratulation and enjoy your fathership- ;) Sincerely, Gour -- As a strong wind sweeps away a boat on the water, even one of the roaming senses on which the mind focuses can carry away a man's intelligence. http://atmarama.net| Hlapicina (Croatia) | GPG: 52B5C810 signature.asc 1KViewDownload
[web2py] Re: SQLFORM.smartgrid query/search don't work for related tables
Jim, Grid has a parameter searchwidget Doesn't that point to a custom search widget? I would very much like to see your solution. On Jan 18, 10:20 pm, Jim Steil j...@qlf.com wrote: Adnan I did not get this working, but that doesn't mean it has been resolved. I've given up on the search that is included in grid/smartgrid and have been working on a solution whereby you can override the default behavior and provide your own. I've got a ticket open (http://code.google.com/p/web2py/issues/detail?id=523) and am just waiting for Massimo to look it over and get it in trunk. I've been using my mod'd sqlhtml.py for some time and it is working really well for me. I'm hoping my mod can get into trunk. If it does I will then write up a little demo of how it all works. It is really quite simple then to provide your own search capabilities with the ability to easily customize it for different pages. -Jim On 1/18/2012 1:59 PM, Adi wrote: Hi Jim, Did you get this working, since I too don't see the referenced field in a query? Thanks, Adnan No virus found in this message. Checked by AVG -www.avg.comhttp://www.avg.com Version: 2012.0.1901 / Virus Database: 2109/4752 - Release Date: 01/18/12 -- Jim Steil VP of Information Technology Quality Liquid Feeds, Inc. 608.935.2345 office 608.341.9896 cell
[web2py] Re: Problem with DB2 and text field type when accessing db2 using ODBC ...
David, I'm successfully using DB2 for internal web app. We used to use i595: O/S V5R3M0 and now we use Power 770: O/S V7R1M0. Yes, it will be created as 'CLOB' and I don't have the problem. (See attachment). Model db.define_table('mytable', Field('mystring'), Field('mytext', 'text') ) SQL CREATE TABLE mytable( id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY NOT NULL, mystring VARCHAR(512), mytext CLOB ); However, I'm also AS400 Developer and don't like to use the 'CLOB' field because it's not supported by DDS and I'm pretyy sure we can not read/write the field with RPG. I prefer using VARCHAR. If you really want to use the text input field on the form, then I remember I tried something like this. 1. Define new table with VARCHAR and let web2py create the table on AS400 You should also specify the length and IS_LENGTH db.define_table('mytable', Field('mystring'), Field('mytext') ) 2. Specify migrate=False and change the field to 'text' In this way, web2py show the field as 'text' but the field on DB2 is still VARCHAR. db.define_table('mytable', Field('mystring'), Field('mytext', 'text'), migrate=False ) 3. Try creating new record attachment: Insert record.PNGattachment: AS400 Part1.PNGattachment: AS400 Part2.PNG
Re: [web2py] Re: SQLFORM.smartgrid query/search don't work for related tables
Even though users can navigate through a parent table's smartgrid to get to children, it would be very valuable to filter children records based on a referenced (parent) table criteria. Unfortunately, I'm not sure yet how to create my own search widget, but I saw a feature available...
[web2py] Re: TYMR - web2py social network - Invitations for this community
Thanks all for the feedback! @Ovidio, the code is not available. @Marin, you shouldn't be able to not select a place to host events at the moment (that functionality is still in development). I've already corrected it. Thanks On Jan 18, 8:07 pm, Marin Pranjić marin.pran...@gmail.com wrote: I tried to create an event (just for testing) and got an error when tried to submit. Actually, I was redirected tohttp://tymr.com/event/draft/697which is e404-not found Marin
[web2py] Re: DAL IMAPAdapter
New features: - set.update() - set.delete() I also fixed Unicode problems on parsing the complete RFC822 message http://code.google.com/p/web2py/issues/detail?id=610#c5 On 17 ene, 13:05, Alan Etkin spame...@gmail.com wrote: The new version of the adapter with fixes and size queries http://code.google.com/p/web2py/issues/detail?id=610#c4
[web2py] Re: bitcoin
Not yet sorry. On Jan 19, 4:40 am, btcgriffin btcgrif...@gmail.com wrote: I like to support web2py project with bitcoin (http://bitcoin.org/). Can I send you this currency ? btcgriffin
[web2py] Re: login with blank password:problem
This should absolutely not be the case. If this is a problem on the web2py side than it is a security issue and it needs to be fixed urgently. I am not convinced this is a web2py problem anyway. Can you show use the code you use to pre-fill the random password? On Jan 19, 6:27 am, Saurabh S ggtestlo...@gmail.com wrote: Hi , i am developing an online booking system in web2py on GAE. The problem that i am facing is when i create an entity (client/ volunteer/employee) in my system , i store a random password in the db (auth_random_password()) and 'pending' in the registration key initially. but when i enable the login (registration_key = ) for an entity. i can login the system without typing anything in the password field. also if i do request_reset_password then the login functionality is working absolutely fine.(email as well as password is required after request_reset_password ) is it neccessary that when ever an entity (client/employee/volunteer) is created that we must do a request reset password in order for login functionality to work properly (with email and valid password) Is there any solution to avoid this ? Please suggest on this Thanks in advance.
[web2py] Re: sqlhtml unicode error
Is the page html header declaring the utf8 encoding or are using in a layout that uses a different encoding? On Jan 19, 7:21 am, Alan Etkin spame...@gmail.com wrote: I found that the Unicode errors are originated because of incompatible encodings when web2py tries to read the raw message and render the data for browser output. I solved it encoding the RFC822 raw text before parsing the response data as Rows. Still i am not sure if this is the correct way for processing the response text so it can be sent safely (without misread characters) to the user interface. Anyway, it seems to work well, without instensive testing. On 18 ene, 18:40, Alan Etkin spame...@gmail.com wrote: I am trying to generate sqltables with the experimental IMAPAdapter select output, but with some rows, an exception is raised at the sqlhtml module. It has to do with unicode and charsets when sqlhtml processes the rows object returned by the adapter's select method, but I cannot find a proper way of solving it. Here is the error trace: Traceback (most recent call last): File /home/alan/web2py-hg/gluon/restricted.py, line 204, in restricted exec ccode in environment File /home/alan/web2py-hg/applications/queries/views/default/ index.html, line 126, in module File /home/alan/web2py-hg/gluon/globals.py, line 181, in write self.body.write(xmlescape(data)) File /home/alan/web2py-hg/gluon/html.py, line 114, in xmlescape return data.xml() File /home/alan/web2py-hg/gluon/dal.py, line 7442, in xml return sqlhtml.SQLTABLE(self).xml() File /home/alan/web2py-hg/gluon/sqlhtml.py, line 2197, in __init__ ur = unicode(r, 'utf8') File /usr/lib/python2.6/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1227-1229: invalid data I found a workaround to avoid the exception but I doubt it's the correct fix, because it just prevents web2py to create the unicode object and use the raw input instead. This is the workaround: (gluon/sqlhtml.py Line 2196) try: ur = unicode(r, 'utf-8') except UnicodeDecodeError, e: ur = r Replacing this line: ur = unicode(r, 'utf8') When creating the Row objects at the adapter, I have to handle different encodings depending on the message. What would be an appropiate way of encoding data before creating the Row objects, so unicode errors can be avoided? This is the adapter method i am using to store the parse input for each text field def encode_text(self, text, charset, errors=replace): convert text for mail to unicode if text is None: text = else: if charset is not None: text = unicode(text, charset, errors) else: text = unicode(text, utf-8, errors) return text Thanks I am using the last source hg version (1.99.4) with Python 2.6.5 on a Mandriva GNU/Linux machine.
[web2py] Trouble with creating static file on the fly.
Dear web2py folks, I am having trouble creating a static file on the fly. Here is the code in dnload_file/controllers/default.py. def make_dl(): myurl = URL('static', 'excel.txt') f = open(myurl,'w') for i in range(20): f.write('This is a test %2s\n'%(i)) f.close() return dict(myurl=myurl) Here is the ticket Traceback. Traceback (most recent call last): File E:\web2py\gluon\restricted.py, line 194, in restricted exec ccode in environment File E:/web2py/applications/dnload_file/controllers/default.py, line 80, in module File E:\web2py\gluon\globals.py, line 149, in lambda self._caller = lambda f: f() File E:/web2py/applications/dnload_file/controllers/default.py, line 21, in make_dl f = open(myurl,'w') IOError: [Errno 2] No such file or directory: '/dnload_file/static/ excel.txt' Any ideas? Thanks for the help in advance. Love and peace, Joe
Re: [web2py] Re: Implementing tornado chat server with web2py
Websocket is not ready , it is just a draft protocol. i wont recommend any serious use on it. On Wed, Jan 18, 2012 at 6:57 AM, Abhishek Gupta abhishekgupta.i...@gmail.com wrote: I implemented a similar solution, but the user keeps on getting disconnected from the tornado server. This happens frequently with chrome. Any guesses, so as why the user is being disconnected so often (in every 4-5 secs).
[web2py] Re: Trouble with creating static file on the fly.
On Thursday, January 19, 2012 11:12:53 AM UTC-5, JoeCodeswell wrote: Dear web2py folks, I am having trouble creating a static file on the fly. Here is the code in dnload_file/controllers/default.py. def make_dl(): myurl = URL('static', 'excel.txt') f = open(myurl,'w') URL() generates a relative URL, but you need to generate a filesystem path, so try: import os myfile = os.path.join(request.folder, 'static', 'excel.txt') f = open(myfile, 'w') Anthony
[web2py] Re: DAL IMAPAdapter
Sounds really good. I guess webmail application would also be an interesting web2py project. Eh, if work days had about 49 hours, I'd be on it right now...
[web2py] Problem with .smartgrid on tables with links
Hi Just updated to the latest trunk this morning and now my smartgrids aren't working where the table being used has links. Here is what I'm getting: Traceback(most recent call last): FileC:\dev\web2py\gluon\restricted.py,line204,inrestricted execccodeinenvironment FileC:/dev/web2py/applications/infocenter/controllers/administration.py http://127.0.0.1:8000/admin/default/edit/infocenter/controllers/administration.py,line1816,inmodule FileC:\dev\web2py\gluon\globals.py,line172,inlambda self._caller=lambdaf:f() FileC:\dev\web2py\gluon\tools.py,line2530,inf returnaction(*a, **b) FileC:/dev/web2py/applications/infocenter/controllers/administration.py http://127.0.0.1:8000/admin/default/edit/infocenter/controllers/administration.py,line457,inassetTypes paginate=15,maxtextlength=45) FileC:\dev\web2py\gluon\sqlhtml.py,line1971,insmartgrid user_signature=user_signature,**kwargs) FileC:\dev\web2py\gluon\sqlhtml.py,line1819,ingrid iflink(row): FileC:\dev\web2py\gluon\sqlhtml.py,line1968,inlambda args=request.args[:nargs]+[args0,row.id]))) FileC:\dev\web2py\gluon\dal.py,line4996,in__getattr__ return self[key] FileC:\dev\web2py\gluon\dal.py,line4987,in__getitem__ returndict.__getitem__(self,key) KeyError:'id' If the table doesn't have any fields referencing other tables, then it works fine. Is it just me? -Jim
Re: [web2py] Re: SQLFORM.smartgrid query/search don't work for related tables
Cliff - I was getting a bunch of stuff together this morning to show you what I'm doing, but when I updated to the latest trunk most of my smartgrids quit working. I will get a sample here for you once I get my installation working again. -Jim On 1/19/2012 8:34 AM, Cliff wrote: Jim, Grid has a parameter searchwidget Doesn't that point to a custom search widget? I would very much like to see your solution. On Jan 18, 10:20 pm, Jim Steilj...@qlf.com wrote: Adnan I did not get this working, but that doesn't mean it has been resolved. I've given up on the search that is included in grid/smartgrid and have been working on a solution whereby you can override the default behavior and provide your own. I've got a ticket open (http://code.google.com/p/web2py/issues/detail?id=523) and am just waiting for Massimo to look it over and get it in trunk. I've been using my mod'd sqlhtml.py for some time and it is working really well for me. I'm hoping my mod can get into trunk. If it does I will then write up a little demo of how it all works. It is really quite simple then to provide your own search capabilities with the ability to easily customize it for different pages. -Jim On 1/18/2012 1:59 PM, Adi wrote: Hi Jim, Did you get this working, since I too don't see the referenced field in a query? Thanks, Adnan No virus found in this message. Checked by AVG -www.avg.comhttp://www.avg.com Version: 2012.0.1901 / Virus Database: 2109/4752 - Release Date: 01/18/12 -- Jim Steil VP of Information Technology Quality Liquid Feeds, Inc. 608.935.2345 office 608.341.9896 cell
[web2py] HOWTO: getting web2py to run on Android mobile devices
In response to a question in another thread, here is a summary of how I got web2py running on my Android device (a Samsung Note), using hints found here and there. Maybe it can save some time for those wanting to do the same thing. Note : I am just getting started with Android, so there are probably better and/or easier ways to do it than what I describe here. Please add to this thread if you see anything missing or incorrect. - First we need to get python running on the device, obviously. This is done by installing SL4A (scripting layer for Android). Get the the apk from http://code.google.com/p/android-scripting/ and install it (requires checking unknown sources in settings/applications) SL4A was initially called ASE (Android scripting engine), so many older Howtos use that instead. Run the app, use menu/view/interpreters : by default there is only shell. Use menu again, add, choose Python. This downloads the installer. Run python for android from your apps list, install... Whew, now we have Python on our device, but it only runs through the SL4A interface. Now we need to get it running from the command line. I used the traditional adb method to connect from the PC to the Android console, with the USB cable. adb can be found in the Android SDK, and is also included in several rooting kits, which are smaller (adb is just one executable and two DLLs under Windows). It also needs the USB drivers for the device, which means installing vendor software (like Kies for Samsung). (Users who already have an SSH daemon running on their device can use ssh and scp and Wifi instead) So, if all goes well, adb shell will connect you to a very basic Linux console on your device. On mine, the SL4A scripts folder is at : /sdcard/sl4a/scripts I chose to do everything in there to be available also from inside the app. You can now verify that python does not run from the command line, because no environment is set. I found this ready-made script that does all the grunt work : http://blog.anantshri.info/android-standalone-python/ Only it seems that paths move around a lot between Android versions and/or devices, so I had to correct them for mine : #! /bin/sh PW=`pwd` export EXTERNAL_STORAGE=/mnt/sdcard export LANG=en PYTHONPATH=/mnt/sdcard/com.googlecode.pythonforandroid/extras/python PYTHONPATH=${PYTHONPATH}:/data/data/com.googlecode.pythonforandroid/ files/python/lib/python2.6/lib-dynload export PYTHONPATH export TEMP=/mnt/storage/com.googlecode.pythonforandroid/extras/python/ tmp export PYTHON_EGG_CACHE=$TEMP export PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/ python export LD_LIBRARY_PATH=/data/data/com.googlecode.pythonforandroid/ files/python/lib cd $PW /data/data/com.googlecode.pythonforandroid/files/python/bin/python $@ Let's save this to py.sh and copy that to the device : adb push py.sh /sdcard/sl4a/scripts Then connect back with 'adb shell' and try 'sh py.sh' : if the paths are OK you should now be in the Python interpreter. Whew again :-) Now comes the web2py part. It's not as easy as it should be, due to some shortcomings in the Android Python distribution. First, you need version 1.97.1 at least (i used 1.99.4, latest as of this writing). Next, even then some things don't work, such as creating an app directly on the device, because of cache problems : https://groups.google.com/group/web2py/browse_thread/thread/461ca3eec3fde4e4/9ab612d9c21604ee?hl=frlnk=gstq=android#9ab612d9c21604ee I worked around this by preparing the web2py environment on the PC first, then copying it over. These are the main steps : * get latest web2py_src.zip * unzip to temp dir on PC * run once so that all initialization steps are done, check the admin app * stop * copy your existing app(s) to the web2py applications folders * (optional) reduce size by deleting example apps, test scripts, errors etc. * re-zip to web2py_a.zip * push to device with adb push web2py_a.zip /sdcard/sl4a/scripts * connect to shell again and unzip Note: on my device 'unzip' would fail to extract the archive because it could not set the permissions. I had to use 'su' first for it to work (the device was already rooted) So now we only need a way to start web2py as a daemon. I created a new 'web2py.sh' shell script, which is the same as py.sh except for the last two lines : #! /bin/sh PW=`pwd` export EXTERNAL_STORAGE=/mnt/sdcard export LANG=en PYTHONPATH=/mnt/sdcard/com.googlecode.pythonforandroid/extras/python PYTHONPATH=${PYTHONPATH}:/data/data/com.googlecode.pythonforandroid/ files/python/lib/python2.6/lib-dynload export PYTHONPATH export TEMP=/mnt/storage/com.googlecode.pythonforandroid/extras/python/ tmp export PYTHON_EGG_CACHE=$TEMP export PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/ python export LD_LIBRARY_PATH=/data/data/com.googlecode.pythonforandroid/ files/python/lib cd $PW cd web2py /data/data/com.googlecode.pythonforandroid/files/python/bin/python web2py.py -l
[web2py] Re: Problem with .smartgrid on tables with links
Do the tables have id fields called other than id? On Jan 19, 10:45 am, Jim Steil j...@qlf.com wrote: Hi Just updated to the latest trunk this morning and now my smartgrids aren't working where the table being used has links. Here is what I'm getting: Traceback(most recent call last): FileC:\dev\web2py\gluon\restricted.py,line204,inrestricted execccodeinenvironment FileC:/dev/web2py/applications/infocenter/controllers/administration.py http://127.0.0.1:8000/admin/default/edit/infocenter/controllers/admin...,line1816,inmodule FileC:\dev\web2py\gluon\globals.py,line172,inlambda self._caller=lambdaf:f() FileC:\dev\web2py\gluon\tools.py,line2530,inf returnaction(*a, **b) FileC:/dev/web2py/applications/infocenter/controllers/administration.py http://127.0.0.1:8000/admin/default/edit/infocenter/controllers/admin...,line457,inassetTypes paginate=15,maxtextlength=45) FileC:\dev\web2py\gluon\sqlhtml.py,line1971,insmartgrid user_signature=user_signature,**kwargs) FileC:\dev\web2py\gluon\sqlhtml.py,line1819,ingrid iflink(row): FileC:\dev\web2py\gluon\sqlhtml.py,line1968,inlambda args=request.args[:nargs]+[args0,row.id]))) FileC:\dev\web2py\gluon\dal.py,line4996,in__getattr__ return self[key] FileC:\dev\web2py\gluon\dal.py,line4987,in__getitem__ returndict.__getitem__(self,key) KeyError:'id' If the table doesn't have any fields referencing other tables, then it works fine. Is it just me? -Jim
Re: [web2py] HOWTO: getting web2py to run on Android mobile devices
Very nice. Really! On Thu, Jan 19, 2012 at 2:56 PM, fpp fpp@gmail.com wrote: In response to a question in another thread, here is a summary of how I got web2py running on my Android device (a Samsung Note), using hints found here and there. Maybe it can save some time for those wanting to do the same thing. Note : I am just getting started with Android, so there are probably better and/or easier ways to do it than what I describe here. Please add to this thread if you see anything missing or incorrect. - First we need to get python running on the device, obviously. This is done by installing SL4A (scripting layer for Android). Get the the apk from http://code.google.com/p/android-scripting/ and install it (requires checking unknown sources in settings/applications) SL4A was initially called ASE (Android scripting engine), so many older Howtos use that instead. Run the app, use menu/view/interpreters : by default there is only shell. Use menu again, add, choose Python. This downloads the installer. Run python for android from your apps list, install... Whew, now we have Python on our device, but it only runs through the SL4A interface. Now we need to get it running from the command line. I used the traditional adb method to connect from the PC to the Android console, with the USB cable. adb can be found in the Android SDK, and is also included in several rooting kits, which are smaller (adb is just one executable and two DLLs under Windows). It also needs the USB drivers for the device, which means installing vendor software (like Kies for Samsung). (Users who already have an SSH daemon running on their device can use ssh and scp and Wifi instead) So, if all goes well, adb shell will connect you to a very basic Linux console on your device. On mine, the SL4A scripts folder is at : /sdcard/sl4a/scripts I chose to do everything in there to be available also from inside the app. You can now verify that python does not run from the command line, because no environment is set. I found this ready-made script that does all the grunt work : http://blog.anantshri.info/android-standalone-python/ Only it seems that paths move around a lot between Android versions and/or devices, so I had to correct them for mine : #! /bin/sh PW=`pwd` export EXTERNAL_STORAGE=/mnt/sdcard export LANG=en PYTHONPATH=/mnt/sdcard/com.googlecode.pythonforandroid/extras/python PYTHONPATH=${PYTHONPATH}:/data/data/com.googlecode.pythonforandroid/ files/python/lib/python2.6/lib-dynload export PYTHONPATH export TEMP=/mnt/storage/com.googlecode.pythonforandroid/extras/python/ tmp export PYTHON_EGG_CACHE=$TEMP export PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/ python export LD_LIBRARY_PATH=/data/data/com.googlecode.pythonforandroid/ files/python/lib cd $PW /data/data/com.googlecode.pythonforandroid/files/python/bin/python $@ Let's save this to py.sh and copy that to the device : adb push py.sh /sdcard/sl4a/scripts Then connect back with 'adb shell' and try 'sh py.sh' : if the paths are OK you should now be in the Python interpreter. Whew again :-) Now comes the web2py part. It's not as easy as it should be, due to some shortcomings in the Android Python distribution. First, you need version 1.97.1 at least (i used 1.99.4, latest as of this writing). Next, even then some things don't work, such as creating an app directly on the device, because of cache problems : https://groups.google.com/group/web2py/browse_thread/thread/461ca3eec3fde4e4/9ab612d9c21604ee?hl=frlnk=gstq=android#9ab612d9c21604ee I worked around this by preparing the web2py environment on the PC first, then copying it over. These are the main steps : * get latest web2py_src.zip * unzip to temp dir on PC * run once so that all initialization steps are done, check the admin app * stop * copy your existing app(s) to the web2py applications folders * (optional) reduce size by deleting example apps, test scripts, errors etc. * re-zip to web2py_a.zip * push to device with adb push web2py_a.zip /sdcard/sl4a/scripts * connect to shell again and unzip Note: on my device 'unzip' would fail to extract the archive because it could not set the permissions. I had to use 'su' first for it to work (the device was already rooted) So now we only need a way to start web2py as a daemon. I created a new 'web2py.sh' shell script, which is the same as py.sh except for the last two lines : #! /bin/sh PW=`pwd` export EXTERNAL_STORAGE=/mnt/sdcard export LANG=en PYTHONPATH=/mnt/sdcard/com.googlecode.pythonforandroid/extras/python PYTHONPATH=${PYTHONPATH}:/data/data/com.googlecode.pythonforandroid/ files/python/lib/python2.6/lib-dynload export PYTHONPATH export TEMP=/mnt/storage/com.googlecode.pythonforandroid/extras/python/ tmp export PYTHON_EGG_CACHE=$TEMP export PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/
[web2py] Re: Trouble with creating static file on the fly.
Dear Anthony, Thanks for the tip. No I am able to create a file for download on the fly. Here's the final code. def make_dl(): import os myurl = URL('static', 'excel.txt') myfile = os.path.join(request.folder, 'static', 'excel.txt') f = open(myfile,'w') for i in range(20): f.write('This is a test %2s\n'%(i)) f.close() # forces download NOT streaming mylink = XML(A('clickme to download',_href=myurl+'?attachment')) return dict(mylink=mylink) Thanks again, Anthony. Love and peace, Joe On Jan 19, 8:25 am, Anthony abasta...@gmail.com wrote: On Thursday, January 19, 2012 11:12:53 AM UTC-5, JoeCodeswell wrote: Dear web2py folks, I am having trouble creating a static file on the fly. Here is the code in dnload_file/controllers/default.py. def make_dl(): myurl = URL('static', 'excel.txt') f = open(myurl,'w') URL() generates a relative URL, but you need to generate a filesystem path, so try: import os myfile = os.path.join(request.folder, 'static', 'excel.txt') f = open(myfile, 'w') Anthony
[web2py] Re: sqlhtml unicode error
The text encoding is read from an email.message.Message created when the mail is fetched from the server and before sending the data to the base adapter parse function (by the way, I sent new versions of the adapter these days to the issue page after it was marked as fixed) In IMAPAdapter I am passing the complete message RFC822 payload to a unicode instance with the charset declared in the message's envelope (or using utf-8 as default), and this way the unicode error doesn't reproduce (without need to change the sqlhtml.py module). I did not edit the layout encoding, I am just using the scaffolding app to test the email queries. The message rows passed to sqltables might contain html, is it possible that these parts are producing unicode errors? On 19 ene, 12:55, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Is the page html header declaring the utf8 encoding or are using in a layout that uses a different encoding? On Jan 19, 7:21 am, Alan Etkin spame...@gmail.com wrote: I found that the Unicode errors are originated because of incompatible encodings when web2py tries to read the raw message and render the data for browser output. I solved it encoding the RFC822 raw text before parsing the response data as Rows. Still i am not sure if this is the correct way for processing the response text so it can be sent safely (without misread characters) to the user interface. Anyway, it seems to work well, without instensive testing. On 18 ene, 18:40, Alan Etkin spame...@gmail.com wrote: I am trying to generate sqltables with the experimental IMAPAdapter select output, but with some rows, an exception is raised at the sqlhtml module. It has to do with unicode and charsets when sqlhtml processes the rows object returned by the adapter's select method, but I cannot find a proper way of solving it. Here is the error trace: Traceback (most recent call last): File /home/alan/web2py-hg/gluon/restricted.py, line 204, in restricted exec ccode in environment File /home/alan/web2py-hg/applications/queries/views/default/ index.html, line 126, in module File /home/alan/web2py-hg/gluon/globals.py, line 181, in write self.body.write(xmlescape(data)) File /home/alan/web2py-hg/gluon/html.py, line 114, in xmlescape return data.xml() File /home/alan/web2py-hg/gluon/dal.py, line 7442, in xml return sqlhtml.SQLTABLE(self).xml() File /home/alan/web2py-hg/gluon/sqlhtml.py, line 2197, in __init__ ur = unicode(r, 'utf8') File /usr/lib/python2.6/encodings/utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1227-1229: invalid data I found a workaround to avoid the exception but I doubt it's the correct fix, because it just prevents web2py to create the unicode object and use the raw input instead. This is the workaround: (gluon/sqlhtml.py Line 2196) try: ur = unicode(r, 'utf-8') except UnicodeDecodeError, e: ur = r Replacing this line: ur = unicode(r, 'utf8') When creating the Row objects at the adapter, I have to handle different encodings depending on the message. What would be an appropiate way of encoding data before creating the Row objects, so unicode errors can be avoided? This is the adapter method i am using to store the parse input for each text field def encode_text(self, text, charset, errors=replace): convert text for mail to unicode if text is None: text = else: if charset is not None: text = unicode(text, charset, errors) else: text = unicode(text, utf-8, errors) return text Thanks I am using the last source hg version (1.99.4) with Python 2.6.5 on a Mandriva GNU/Linux machine.
Re: [web2py] Re: Problem with .smartgrid on tables with links
Yes, my tables are all similar to this: assetType = db.define_table('assetType', Field('assetTypeId', 'id'), Field('name', length=50, required=True, unique=True), format='%(name)s') -Jim On 1/19/2012 11:34 AM, Massimo Di Pierro wrote: Do the tables have id fields called other than id? On Jan 19, 10:45 am, Jim Steilj...@qlf.com wrote: Hi Just updated to the latest trunk this morning and now my smartgrids aren't working where the table being used has links. Here is what I'm getting: Traceback(most recent call last): FileC:\dev\web2py\gluon\restricted.py,line204,inrestricted execccodeinenvironment FileC:/dev/web2py/applications/infocenter/controllers/administration.pyhttp://127.0.0.1:8000/admin/default/edit/infocenter/controllers/admin...,line1816,inmodule FileC:\dev\web2py\gluon\globals.py,line172,inlambda self._caller=lambdaf:f() FileC:\dev\web2py\gluon\tools.py,line2530,inf returnaction(*a, **b) FileC:/dev/web2py/applications/infocenter/controllers/administration.pyhttp://127.0.0.1:8000/admin/default/edit/infocenter/controllers/admin...,line457,inassetTypes paginate=15,maxtextlength=45) FileC:\dev\web2py\gluon\sqlhtml.py,line1971,insmartgrid user_signature=user_signature,**kwargs) FileC:\dev\web2py\gluon\sqlhtml.py,line1819,ingrid iflink(row): FileC:\dev\web2py\gluon\sqlhtml.py,line1968,inlambda args=request.args[:nargs]+[args0,row.id]))) FileC:\dev\web2py\gluon\dal.py,line4996,in__getattr__ return self[key] FileC:\dev\web2py\gluon\dal.py,line4987,in__getitem__ returndict.__getitem__(self,key) KeyError:'id' If the table doesn't have any fields referencing other tables, then it works fine. Is it just me? -Jim
Re: [web2py] Re: Announcement
Thanks guys! Richard On Thu, Jan 19, 2012 at 9:30 AM, Cliff cjk...@gmail.com wrote: Congratulations, Richard. All the best to your family. On Jan 19, 3:38 am, Gour g...@atmarama.net wrote: On Wed, 18 Jan 2012 21:26:48 -0500 Richard Vézina ml.richard.vez...@gmail.com wrote: Hello Everybody, I just would like to announce that Mathilde is born the 8 of january. I will be away from my computer a few more weeks... Congratulation and enjoy your fathership- ;) Sincerely, Gour -- As a strong wind sweeps away a boat on the water, even one of the roaming senses on which the mind focuses can carry away a man's intelligence. http://atmarama.net| Hlapicina (Croatia) | GPG: 52B5C810 signature.asc 1KViewDownload
[web2py] Standalone DAL
I know this was discussed before on the maillist, but i I can't find a clair guide to make DAL working. Anyone can help me or give me a link to a slice? I just want to use the web2py DAL on other python project. Thank you.
[web2py] Re: Standalone DAL
Ok, I found this. *oops* Thanks anyway ;) http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define-tables 2012/1/19 Albert Abril albert.ab...@gmail.com I know this was discussed before on the maillist, but i I can't find a clair guide to make DAL working. Anyone can help me or give me a link to a slice? I just want to use the web2py DAL on other python project. Thank you.
[web2py] Re: Problem with .smartgrid on tables with links
Now I know where to look for the fix. :-) On Jan 19, 12:58 pm, Jim Steil j...@qlf.com wrote: Yes, my tables are all similar to this: assetType = db.define_table('assetType', Field('assetTypeId', 'id'), Field('name', length=50, required=True, unique=True), format='%(name)s') -Jim On 1/19/2012 11:34 AM, Massimo Di Pierro wrote: Do the tables have id fields called other than id? On Jan 19, 10:45 am, Jim Steilj...@qlf.com wrote: Hi Just updated to the latest trunk this morning and now my smartgrids aren't working where the table being used has links. Here is what I'm getting: Traceback(most recent call last): FileC:\dev\web2py\gluon\restricted.py,line204,inrestricted execccodeinenvironment FileC:/dev/web2py/applications/infocenter/controllers/administration.pyhttp://127.0.0.1:8000/admin/default/edit/infocenter/controllers/admin...,line1816,inmodule FileC:\dev\web2py\gluon\globals.py,line172,inlambda self._caller=lambdaf:f() FileC:\dev\web2py\gluon\tools.py,line2530,inf returnaction(*a, **b) FileC:/dev/web2py/applications/infocenter/controllers/administration.pyhttp://127.0.0.1:8000/admin/default/edit/infocenter/controllers/admin...,line457,inassetTypes paginate=15,maxtextlength=45) FileC:\dev\web2py\gluon\sqlhtml.py,line1971,insmartgrid user_signature=user_signature,**kwargs) FileC:\dev\web2py\gluon\sqlhtml.py,line1819,ingrid iflink(row): FileC:\dev\web2py\gluon\sqlhtml.py,line1968,inlambda args=request.args[:nargs]+[args0,row.id]))) FileC:\dev\web2py\gluon\dal.py,line4996,in__getattr__ return self[key] FileC:\dev\web2py\gluon\dal.py,line4987,in__getitem__ returndict.__getitem__(self,key) KeyError:'id' If the table doesn't have any fields referencing other tables, then it works fine. Is it just me? -Jim
[web2py] Re: An error in a SQLFORM.grid with multi-byte characters?
Proposal (see issue 626): Try: s = 'äöü€' for i in range(10): ... print s[:i]+'...' ... ... �... ä... ä�... äö... äö�... äöü... äöü�... äöü��... äöü€... for i in range(10): ... print s*.decode('utf-8')*[:i]*.encode('utf-8')*+'...'... ... ä... äö... äöü... äöü€... äöü€... äöü€... äöü€... äöü€... äöü€... In an SQLFORM.grid strings, which are too long, will be cropped. But multi-byte characters should not be split. Proposal: gluon/sqlhtml.py, line 1800 Change: elif isinstance(value,str) and len(value)maxtextlength: value=value[:maxtextlengths.get(str(field),maxtextlength)]+'...' to: elif isinstance(value,str) and len(value)maxtextlength: value=value*.decode('utf-8')*\ [:maxtextlengths.get(str(field),maxtextlength)]\ *.encode('utf-8')*+'...' Maybe there is a better solution, but it works. 2012/1/12 Martin Weissenboeck mweis...@gmail.com Let's say I have made a SQLFORM.grid. There is a cell containing --ÄÖÜ and everything looks fine: --ÄÖÜ If I add one hyphen the string will be too long. But it is not the whole character 'Ü' which will be cropped, it's only the second byte. The utf-8 coding of 'Ü' is 0xC39C and the grid tries to display ÄÖ and 0xC3: ---ÄÖ�... Any solutions? Martin
[web2py] Re: SQLFORM.smartgrid query/search don't work for related tables
+1 for a resolution on this. On Jan 19, 1:20 pm, Jim Steil j...@qlf.com wrote: Adnan I did not get this working, but that doesn't mean it has been resolved. I've given up on the search that is included in grid/smartgrid and have been working on a solution whereby you can override the default behavior and provide your own. I've got a ticket open (http://code.google.com/p/web2py/issues/detail?id=523) and am just waiting for Massimo to look it over and get it in trunk. I've been using my mod'd sqlhtml.py for some time and it is working really well for me. I'm hoping my mod can get into trunk. If it does I will then write up a little demo of how it all works. It is really quite simple then to provide your own search capabilities with the ability to easily customize it for different pages. -Jim On 1/18/2012 1:59 PM, Adi wrote: Hi Jim, Did you get this working, since I too don't see the referenced field in a query? Thanks, Adnan No virus found in this message. Checked by AVG -www.avg.comhttp://www.avg.com Version: 2012.0.1901 / Virus Database: 2109/4752 - Release Date: 01/18/12 -- Jim Steil VP of Information Technology Quality Liquid Feeds, Inc.608.935.2345begin_of_the_skype_highlighting608.935.2345 office608.341.9896begin_of_the_skype_highlighting608.341.9896 cell
[web2py] error importing custom modules into controller
I'm moving a whole bunch of (perfectly functional) business logic from model files to custom modules. But when I try to import the modules in my controllers custom_import is throwing an error. Here's the traceback: File /home/ian/web2py/gluon/restricted.py, line 204, in restricted exec ccode in environment File /home/ian/web2py/applications/paideia/controllers/default.py http://127.0.0.1:8000/admin/default/edit/paideia/controllers/default.py, line 5, in module import paideia_stats, paideia_timestats, paideia_weeklycount File /home/ian/web2py/gluon/custom_import.py, line 284, in __call__ globals, locals, fromlist, level) File /home/ian/web2py/gluon/custom_import.py, line 312, in __import__dot locals, [name], level) File /home/ian/web2py/gluon/custom_import.py, line 132, in __call__ raise e # Don't hide something that went wrong TypeError: __init__() takes at least 2 arguments (1 given) Here's the import statement that opens the controller: 4 import datetime 5 from paideia_stats import paideia_stats, paideia_timestats, paideia_weeklycount 6 from paideia_bugs import paideia_bugs The import of datetime is working fine, but custom_import is choking on my first import from appname/modules/ (where I've placed the paideia_stats.py module file). I've done a lot of work to try and track down the problem, but I think I just don't know the core classes well enough. Any help would be greatly appreciated.
[web2py] Re: Problem with DB2 and text field type when accessing db2 using ODBC ...
On windows7 I solved the issue by adding to db2cli.ini these rows (replace MYDATABASE and MYDATABASEALIAS with your data): [MYDATABASE] dbalias=MYDATABASEALIAS LONGDATACOMPAT=1 LOBMAXCOLUMNSIZE=1048575 if you need more info about db2cli.ini go to this page http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.apdv.cli.doc%2Fdoc%2Fc0007882.html
[web2py] Setting mysql collation in web2py?
Hey, I was wondering if there's any way to set the collation of the mysql tables created by web2py to utf8_bin. Thanks!
[web2py] Re: Paypal Mass Pay API
How will i use it ?
Re: [web2py] Setting mysql collation in web2py?
may be this argument db = DAL(mysql://, * db_codec*='UTF-8') On Thu, Jan 19, 2012 at 6:47 PM, mdorval rockingdor...@gmail.com wrote: Hey, I was wondering if there's any way to set the collation of the mysql tables created by web2py to utf8_bin. Thanks! -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] Setting mysql collation in web2py?
BTW, DAL receives another argument driver_args = None You can pass args to the mysql driver
Re: [web2py] Setting mysql collation in web2py?
Thanks for the note! I've tried passing to the driver_args a Charset object (defined by the pymysql lib like so): from gluon.contrib.pymysql import charset passing into DAL DAL(,driver_args={'charset':charset.charset_by_id(83)) in the charset module this is the Charset object I'm referring to: _charsets.add(Charset(83, 'utf8', 'utf8_bin', '')) but passing in that charset doesn't appear to be anything, as the table is still created as the default utf8 collation, utf8_general_ci. In fact, I don't see any reference in the pymysql code (or even web2py for that matter) that involves actually setting the collation, which leaves me baffled as to why the charset module exists in the first place. The db_codec doesn't appear to help either, because it doesn't seem to recognize utf8_bin. I might be delving a little too deep here for something that web2py simply can't do... Thanks!
[web2py] Re: SQLFORM.smartgrid query/search don't work for related tables
when you say quit working can you get more details? trackeback? wrong behaviour? what behaviour? On Jan 19, 10:47 am, Jim Steil j...@qlf.com wrote: Cliff - I was getting a bunch of stuff together this morning to show you what I'm doing, but when I updated to the latest trunk most of my smartgrids quit working. I will get a sample here for you once I get my installation working again. -Jim On 1/19/2012 8:34 AM, Cliff wrote: Jim, Grid has a parameter searchwidget Doesn't that point to a custom search widget? I would very much like to see your solution. On Jan 18, 10:20 pm, Jim Steilj...@qlf.com wrote: Adnan I did not get this working, but that doesn't mean it has been resolved. I've given up on the search that is included in grid/smartgrid and have been working on a solution whereby you can override the default behavior and provide your own. I've got a ticket open (http://code.google.com/p/web2py/issues/detail?id=523) and am just waiting for Massimo to look it over and get it in trunk. I've been using my mod'd sqlhtml.py for some time and it is working really well for me. I'm hoping my mod can get into trunk. If it does I will then write up a little demo of how it all works. It is really quite simple then to provide your own search capabilities with the ability to easily customize it for different pages. -Jim On 1/18/2012 1:59 PM, Adi wrote: Hi Jim, Did you get this working, since I too don't see the referenced field in a query? Thanks, Adnan No virus found in this message. Checked by AVG -www.avg.comhttp://www.avg.com Version: 2012.0.1901 / Virus Database: 2109/4752 - Release Date: 01/18/12 -- Jim Steil VP of Information Technology Quality Liquid Feeds, Inc. 608.935.2345 office 608.341.9896 cell
Re: [web2py] Re: SQLFORM.smartgrid query/search don't work for related tables
Massimo I'm referring to the issue I reported in this thread: http://groups.google.com/group/web2py/browse_thread/thread/280f6b746e2b7201# It is where I'm using an id column not named 'id'. -Jim On 1/19/2012 4:41 PM, Massimo Di Pierro wrote: when you say quit working can you get more details? trackeback? wrong behaviour? what behaviour? On Jan 19, 10:47 am, Jim Steilj...@qlf.com wrote: Cliff - I was getting a bunch of stuff together this morning to show you what I'm doing, but when I updated to the latest trunk most of my smartgrids quit working. I will get a sample here for you once I get my installation working again. -Jim On 1/19/2012 8:34 AM, Cliff wrote: Jim, Grid has a parameter searchwidget Doesn't that point to a custom search widget? I would very much like to see your solution. On Jan 18, 10:20 pm, Jim Steilj...@qlf.comwrote: Adnan I did not get this working, but that doesn't mean it has been resolved. I've given up on the search that is included in grid/smartgrid and have been working on a solution whereby you can override the default behavior and provide your own. I've got a ticket open (http://code.google.com/p/web2py/issues/detail?id=523) and am just waiting for Massimo to look it over and get it in trunk. I've been using my mod'd sqlhtml.py for some time and it is working really well for me. I'm hoping my mod can get into trunk. If it does I will then write up a little demo of how it all works. It is really quite simple then to provide your own search capabilities with the ability to easily customize it for different pages. -Jim On 1/18/2012 1:59 PM, Adi wrote: Hi Jim, Did you get this working, since I too don't see the referenced field in a query? Thanks, Adnan No virus found in this message. Checked by AVG -www.avg.comhttp://www.avg.com Version: 2012.0.1901 / Virus Database: 2109/4752 - Release Date: 01/18/12 -- Jim Steil VP of Information Technology Quality Liquid Feeds, Inc. 608.935.2345 office 608.341.9896 cell
[web2py] permissions problems on ubuntu 11.10
I thought this was going to be easy. Boy, was I wrong. Lots of good documentation for ubuntu 11.10 from both ubuntu and linode. I got apache, ssl, mysql, php, mod_wsgi, and phpmyadmin working perfectly first time, no stumbles. But, then I tried to make the mods to httpd.conf (really, its includes) to enable wsgi for web2py. No go. I think I am running into all kinds of user / group permissions problems where the OS blocks permission. Here is the apache2 error log of my last attempt: Thu Jan 19 22:42:19 2012] [error] ERROR:web2py:Traceback (most recent call last): [Thu Jan 19 22:42:19 2012] [error] File /usr/lib/python2.7/web2py/ gluon/main.py, line 441, in wsgibase [Thu Jan 19 22:42:19 2012] [error] create_missing_app_folders(request) [Thu Jan 19 22:42:19 2012] [error] File /usr/lib/python2.7/web2py/ gluon/admin.py, line 451, in create_missing_app_folders [Thu Jan 19 22:42:19 2012] [error] os.mkdir(path) [Thu Jan 19 22:42:19 2012] [error] OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/web2py/applications/welcome/databases' [Thu Jan 19 22:42:19 2012] [error] I am really leary of running big scripts because things change that I don't want to change. The only real exceptions I need are a way to setup an alias to access phpmyadmin via ssl to administer the mysql databases. it would be nice to also have an alias for a trivial static html file so that I can quickly verify that the overall domain is accessible. I tried to follow a script that Massimo recommended, just pasting in things for the default file (defining virtual hosts). I also ran any step manually from the script that I had not previously performed. The sudo's to do what I think are creating a web2py group may not have worked. Here is the link to that script: http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ubuntu.sh When running the sudo - u python -c ... lines at the bottom I have never successfully gotten a parameters.80 or parameters.443 file (realize I don't have the exact name correct--but I am not doing it manually--trying to let the bash command do it) to be created. Likely part of the problem. The only changes I have made are to split the .conf files for virtualhost *:80 and virtualhost *:443 into two files instead of combining them and adding the aliases mentioned above. I think there is also a question of whether I need a DocumentRoot directive. I have tried with and without (which is probably right) and it doesn't matter. I think the os permissions are the problem. web2py needs rwx privileges on pretty much everything within the web2py directory I guess. But, I have not seen any of the recipes explicitly address this--so I had not realized that I had to manually change them. I need to learn a lot more about user and group permissions on Linux. There are just layers and layers to the onion. I thought I was mostly programming python, learning a framework, configuring apache, cleaning up html and css, and understanding how the framework does its queries-- all of which I have made much progress on. But, there is seemingly no end to the multi-layered complex dependencies. I bet this will turn out to be something simpler than I realize. At least I hope so. Thanks.
[web2py] begin a transaction manually ?
hi all, 1) is it possible to begin a transaction manually within a controller ? 2) can I start more than one transaction ? 3) question 1 for DAL in a non web2py application ? thanks
[web2py] Re: begin a transaction manually ?
1) db.commit() closes a transactions and starts a new one. 2) yes but not concurrently, unless you have two db objects. 3) it is the same. On Jan 19, 5:02 pm, sebastian sebastianov...@gmail.com wrote: hi all, 1) is it possible to begin a transaction manually within a controller ? 2) can I start more than one transaction ? 3) question 1 for DAL in a non web2py application ? thanks
[web2py] cluster: distributed locks
Hi All, just thinking on how to implement a distributed locking system in web2py using a DB: one row per each lock, lock_name is unique, if the row doesn't exist, then it is locked, if the row exist already, then it cannot be lock as it is already locked ! I'd like to create a module like this (that can be called from anywhere in web2py) def lock(lock name): begin transaction does the row exist ? no = insert new row commit transaction return result def unlock(lock_name): begin transaction delete row where name = lock_name commit transaction BUT not sure if this is possible (of course it is !) in web2py... consider this controller def hello1(): do a lot of things db.commit() do more things in the DB ### here is my doubt: ### if lock(some resource): ### I'm calling a method that opens and close a transaction inside a transaction !!! do something unlock(some resource) else do something else another example 3 if lock(resource A): if lock(resource B): do a lot of things woth both resources unlock(resource B) unlock(resource A) else so other things unlock(resource A) do more things db.commit() do more staff any better idea ? thansk
[web2py] Re: permissions problems on ubuntu 11.10
Solved. Needed to add the www-data group to the location where I installed web2py and to phpmyadmin. Everything works as I want it to including a little static file served by apache to make sure the server is up, access via ssl to phpmyadmin, access to the test app for wsgi to make sure wsgi is running, and access to all the web2py applications and admin ui. Now I need to do some cleanup for fixes that weren't fixes. I guess this user/group permission thing doesn't come up for that many people if you follow the exact recipes. Linux distros tend to ship with certain users/groups set up as owners of cerrtain directories. If you put things there then all is good. If you put things in other places, then you have to adjust. It just seems like a bad idea to put web2py in the www directory even if it set to Deny from All. It just doesn't need to be there. Pretty much nothing should be in www except sites built primarily of static html files. Generally linode has been a very good experience and ubuntu is legions better than xampp, of course. On Jan 19, 3:02 pm, Likit lewis_le...@hotmail.com wrote: I thought this was going to be easy. Boy, was I wrong. Lots of good documentation for ubuntu 11.10 from both ubuntu and linode. I got apache, ssl, mysql, php, mod_wsgi, and phpmyadmin working perfectly first time, no stumbles. But, then I tried to make the mods to httpd.conf (really, its includes) to enable wsgi for web2py. No go. I think I am running into all kinds of user / group permissions problems where the OS blocks permission. Here is the apache2 error log of my last attempt: Thu Jan 19 22:42:19 2012] [error] ERROR:web2py:Traceback (most recent call last): [Thu Jan 19 22:42:19 2012] [error] File /usr/lib/python2.7/web2py/ gluon/main.py, line 441, in wsgibase [Thu Jan 19 22:42:19 2012] [error] create_missing_app_folders(request) [Thu Jan 19 22:42:19 2012] [error] File /usr/lib/python2.7/web2py/ gluon/admin.py, line 451, in create_missing_app_folders [Thu Jan 19 22:42:19 2012] [error] os.mkdir(path) [Thu Jan 19 22:42:19 2012] [error] OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/web2py/applications/welcome/databases' [Thu Jan 19 22:42:19 2012] [error] I am really leary of running big scripts because things change that I don't want to change. The only real exceptions I need are a way to setup an alias to access phpmyadmin via ssl to administer the mysql databases. it would be nice to also have an alias for a trivial static html file so that I can quickly verify that the overall domain is accessible. I tried to follow a script that Massimo recommended, just pasting in things for the default file (defining virtual hosts). I also ran any step manually from the script that I had not previously performed. The sudo's to do what I think are creating a web2py group may not have worked. Here is the link to that script: http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ub... When running the sudo - u python -c ... lines at the bottom I have never successfully gotten a parameters.80 or parameters.443 file (realize I don't have the exact name correct--but I am not doing it manually--trying to let the bash command do it) to be created. Likely part of the problem. The only changes I have made are to split the .conf files for virtualhost *:80 and virtualhost *:443 into two files instead of combining them and adding the aliases mentioned above. I think there is also a question of whether I need a DocumentRoot directive. I have tried with and without (which is probably right) and it doesn't matter. I think the os permissions are the problem. web2py needs rwx privileges on pretty much everything within the web2py directory I guess. But, I have not seen any of the recipes explicitly address this--so I had not realized that I had to manually change them. I need to learn a lot more about user and group permissions on Linux. There are just layers and layers to the onion. I thought I was mostly programming python, learning a framework, configuring apache, cleaning up html and css, and understanding how the framework does its queries-- all of which I have made much progress on. But, there is seemingly no end to the multi-layered complex dependencies. I bet this will turn out to be something simpler than I realize. At least I hope so. Thanks.
[web2py] Using ?attachnment problem with '.enc' file suffix
Dear web2py folks, I am trying to force the download of a a file named 'allLists.xls.enc'. using '?attachment' after the URL. I am getting similar errors from Firefox and Opera: Firefox doesn't know how to open this address, because the protocol (e) isn't associated with any program. Here is the HTML source for the URL. a href=E:\web2py\applications\scramble\private\allLists.xls.enc? attachmentallLists.xls.enc/a I don't want Firefox or Opera to open the file I just want the file to download. Does anyone have any ideas? Thanks in advance. Love and peace, Joe
[web2py] Re: Using ?attachnment problem with '.enc' file suffix
On Thursday, January 19, 2012 10:18:24 PM UTC-5, JoeCodeswell wrote: Dear web2py folks, I am trying to force the download of a a file named 'allLists.xls.enc'. using '?attachment' after the URL. I am getting similar errors from Firefox and Opera: Firefox doesn't know how to open this address, because the protocol (e) isn't associated with any program. Here is the HTML source for the URL. a href=E:\web2py\applications\scramble\private\allLists.xls.enc? attachmentallLists.xls.enc/a Your href is a filesystem path rather than a URL. If you want web2py to serve the file, then you need a regular web2py URL, and if you want it served as a static file, it must be in the static folder. If you put the file in the static folder, set the URL as follows: a href={{=URL('static', 'allLists.xls.enc?attachment')}} Anthony
[web2py] Re: Using ?attachnment problem with '.enc' file suffix
Dear Anthony, Big thanks. Works great. Love and peace, Joe On Jan 19, 7:29 pm, Anthony abasta...@gmail.com wrote: On Thursday, January 19, 2012 10:18:24 PM UTC-5, JoeCodeswell wrote: Dear web2py folks, I am trying to force the download of a a file named 'allLists.xls.enc'. using '?attachment' after the URL. I am getting similar errors from Firefox and Opera: Firefox doesn't know how to open this address, because the protocol (e) isn't associated with any program. Here is the HTML source for the URL. a href=E:\web2py\applications\scramble\private\allLists.xls.enc? attachmentallLists.xls.enc/a Your href is a filesystem path rather than a URL. If you want web2py to serve the file, then you need a regular web2py URL, and if you want it served as a static file, it must be in the static folder. If you put the file in the static folder, set the URL as follows: a href={{=URL('static', 'allLists.xls.enc?attachment')}} Anthony
[web2py] Re: using sum with left join
+1 Thanks Massimo! This one helped a lot!
[web2py] passing navigational links in the header and ajax woes
Currently, in my application, I am passing navigational links in the header, such as /app/controller/view/1/2/3 Where 1/2/3 are things the controller and view use to set the correct page. In my application, I am finding two problems with this. First is security. Although I have written validation on my controllers (I hope), I just worry that with more users some malicious person will find a way to get access they shouldn't. Second and more urgent is my application broke when I tried to write my first ajax function, I assume because the navigational variables are competing with the ajax variables somehow. I say this because when I make the controller empty and just return a dict everything works as normal. However, when I have the controller look for variables in request.vars and I then try to call an ajax function, it breaks hideously. I don't claim to be a great programmer, so it could definitely be a convention I am not following. Has anyone had this problem before? How did you solve it? Should I pass my request.vars into the session and then have the view call them? I read in the book that I can do ajax trapping and I haven't tried that yet, but I didn't think it would be necessary since I could make it work without it. I will try it, but regardless I would love to get some feedback. for clarity, my code causing problems is below: def my_func(): if request.args: #First, I check to see if there is a record, if there is, I get some information. check=db(db.mydb.id==request.args(0)).select().first() if check !=None: records=db(db.mydb.id==request.args(0)).select() row = db(db.mydb.id==request.args(0)).select().first() counter=len(records) #if it isnt, I make it with a function else: row = db(db.mydb.id==request.args(0)).select().first() my_id=row.id (filename, stream) = db.mydb.myfield.retrieve(row.resourcefield) myfunc(id,filename,stream) records=db(db.mydb.id==request.args(0)).select() counter=len(records) pass #if there is no specific document request, generate a list of available files else: redirect(URL('mycontroller','this_function')) return(counter=counter, records=records, row=row) def myajaxfunc(): form=SQLFORM(db.mydb2, _action=myajaxfunc) if form.errors: session.flash=Error: + str(form.errors) return XML(form) my view: {{for i in range(1,5):}} div id=my_div onclick=ajax('myajaxfunc',[''], 'mytarget_{{=str(i)}}')Click me to add a note/div div id=mytarget_{{=str(i)}}/div {{pass}}
Re: [web2py] Re: Record Versioning
No, I'm simply playing with SQLite. It's only for evaluation only. Anyway, I also noticed that it would store a new record regardless there is a modification in a field or not. Is it normal? Is there a way to avoid storing new record if in the end there is no difference when compared to previous record? Thanks, JF
[web2py] Re: Problem with DB2 and text field type when accessing db2 using ODBC ...
Thank you !!! This setting s in db2cli.ini is really working for me without any further chnage in web2py tables. Nice. Also how do you access db2 from web2py? Do you use ODBC or native driver? I'm asking because ODBC is working for me just fine, but I also installed DB2 python driver and changed the connection string to something like db2://username:password@my_db but it doesnt work for me, still getting some strange error that connection cannot be provided. Whats your experience here? David