[web2py] criticism of web2py
Hello! I'm starting with python & web2py and yesterday visited Hello, I'm starting with Python & Web2Py and yesterday visited one python-related project channel where I mentioned web2py and as the consequence I was quickly advised to abandon it due to 'non-Pythonic' etc. This is not the first time I hear people criticise web2py due to, amongst other things, breaking "Explicit is better than implicit." principle alothough Massimo nicely explains it in the introduction of web2py book. I played for sometime with the Haskell, but eventuall abandon it due to not being pragmatic enough for daily use (e.g. all GUI bindings are maintained by few people only). The same situation was/is with D. Now, I see Python as very pragmatic language, with lot of 'batteries included' and very suitable for all kinds of tasks, so I wonder waht is the real reason of web2py criticism: a) stubborness of (python) people to see that "Explicit is better than implicit." is not engraved in stone and can be violated to keep DRY, b) envy of web2py's success c) something else? As far as I'm concerned, I do not care much 'cause I'm accustomed to do things which are not mainstream, but just curios what do you think? Sincerely, Gour -- “In the material world, conceptions of good and bad are all mental speculations…” (Sri Caitanya Mahaprabhu) http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 signature.asc Description: PGP signature
Re: [web2py] criticism of web2py
> Hello! > > I'm starting with python & web2py and yesterday visited > Hello, > > I'm starting with Python & Web2Py and yesterday visited one python-related > project channel where I mentioned web2py and as the consequence I was > quickly > advised to abandon it due to 'non-Pythonic' etc. > > This is not the first time I hear people criticise web2py due to, amongst > other > things, breaking "Explicit is better than implicit." principle alothough > Massimo nicely explains it in the introduction of web2py book. > > I played for sometime with the Haskell, but eventuall abandon it due to > not > being pragmatic enough for daily use (e.g. all GUI bindings are maintained > by > few people only). The same situation was/is with D. > > Now, I see Python as very pragmatic language, with lot of 'batteries > included' > and very suitable for all kinds of tasks, so I wonder waht is the real > reason > of web2py criticism: > > a) stubborness of (python) people to see that "Explicit is better than > implicit." is not engraved in stone and can be violated to keep DRY, > > b) envy of web2py's success > > c) something else? > > As far as I'm concerned, I do not care much 'cause I'm accustomed to do > things > which are not mainstream, but just curios what do you think? > > If you want an adivse, do not trust those kind of people. Whoever claim itself a technology-guy and has fear of diversity, or 'non-ortodox' approaches should probably start looking in other areas... If someone blaim a project because it does not work, it has horrible documentation or the author likes killing kitten, this is good. But blaming a project for not being loyal to some concept is silly. It looks like more a religious approach than a techy one. Web2py works (and most of the time it simply works thanks to its design), it is well documented and AFAIK Massimo does not like killing kittens. But yes, if your priest.py does not approve it, do not use it :P -- Roberto De Ioris http://unbit.it
Re: [web2py] Re: 1.99.1 and ssl/https
That error is sometimes associated to misconfiguration. I.e. missing or wrong certs on the server. mic Il giorno 25/set/2011 08:22, "Massimo Di Pierro" ha scritto: > Can you help us debug this? Do you get this error with 1.99.1 and not > with 1.98.2? Could it be related to this: > http://stackoverflow.com/questions/2538723/ssl-received-a-record-that-exceeded-the-maximum-permissible-length-error-code > > Massimo > > On Sep 24, 9:47 pm, "Cameron" wrote: >> Just tried ssl via the admin console. >> >> Running windows 7 64 with 32 bit (I think) python 2.7.2. >> >> Got this in firefox version 6.x: >> "" >> Secure Connection Failed >> An error occurred during a connection to 127.0.0.1:8000. >> SSL received a record that exceeded the maximum permissible length. >> (Error code: ssl_error_rx_record_too_long) >> "" >> >> Got this in chrome: >> "" >> Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error. >> "" >> >> Opera just sits with the hour glass running. >> >> IE doesn't say much of anything, but the site doesn't come up. >> >> Works great without ssl. >> >> Can't find any error log entry in the admin app error page. I'm a beginner >> with web2py but I can do a packet capture if you tell me where to send it. >> >> >> >> >> >> >> >> -Original Message- >> From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of >> >> Massimo Di Pierro >> Sent: Saturday, September 24, 2011 8:02 PM >> To: web2py-users >> Subject: [web2py] 1.99.1 and ssl/https >> >> Has anybody tried 1.99.1 with https (other thank Dirk)? We have a strange >> error logged and we cannot get to the bottom of it. Perhaps if you have >> tried on other OSes/Python version it can help us narrow it downs. It seems >> to work even if the error is logged. >> >> Massimo
[web2py] Re: criticism of web2py
On Sun, 25 Sep 2011 10:04:19 +0200 (CEST) "Roberto De Ioris" wrote: > If you want an adivse, do not trust those kind of people. :-) > Whoever claim itself a technology-guy and has fear of diversity, or > 'non-ortodox' approaches should probably start looking in other > areas... /me fully agrees > If someone blaim a project because it does not work, it has horrible > documentation or the author likes killing kitten, this is good. But blaming a > project for not being loyal to some concept is silly. It looks like more a > religious approach than a techy one. Indeed. > Web2py works (and most of the time it simply works thanks to its > design), it is well documented and AFAIK Massimo does not like > killing kittens. That's good to know. ;) > But yes, if your priest.py does not approve it, do not use it :P I'll investigate about it, but it might be that priest.py is even recommending it. :-D Sincerely, Gour -- “In the material world, conceptions of good and bad are all mental speculations…” (Sri Caitanya Mahaprabhu) http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 signature.asc Description: PGP signature
[web2py] web2py handlers
Dear All , hey guys , when i run web2py on windows from source with my own python it keeps giving me this : No handlers could be found for logger "web2py" ,, why ?? what to do ? it keeps giving me a warning like this : WARNING:web2py.cron:WB2PY CRON : Disabled because no file locking ...
Re: [web2py] web2py handlers
I see this message every time I starte web2py, and I just ignore it :)
Re: [web2py] Re: table, grid, smartgrid, getting better
Thanks Massimo. On 25 September 2011 00:02, Massimo Di Pierro wrote: > Yes they are: > > grid=SQLFORM.smartgrid(db.person,ui='jquery-ui') > > On Sep 24, 12:48 pm, Ivica Kralj wrote: > > Hi, > > > > I'm quite impressed with the features in this release (also it didn't > break > > anything :) ) > > > > Just a question for Martin or Bruno, or anybody who knows the answer > > regarding smartrgid/grid and Jquery UI themes application. I've spent few > > hours searching through this group and couldn't find the answer. > > > > Are Jquery UI themes supported by default in grid/smartgrid (I know there > > was talk about this but no sure if it's implemented) and if not how to > > activate it? I've seen there is a patch, but again not sure if it was > > applied to latest release. > > > > I tried few variation, and I'm running out ideas (last option is to check > > the code, but posting this question here might be faster and beneficial > to > > other users) > > > > grid=SQLFORM.smartgrid(db.person,jqueryui=True) ##wrong, do not > use### > > > > For example in this demo Jquery UI css is used. > > > > http://labs.blouweb.com/web2pygrid/default/index?jqueryui=true > > > > > While in my app using smartgrid html looks like this > > > > > > > Thanks > > I > > > > On 24 August 2011 11:13, Bruno Rocha wrote: > > > > > > > > > > > > > > > > > JqueryUI Applied! (Any Theme fromhttp://jqueryui.com/themeroller) > > > > > Take a look in attached screenshots (a patch is comming to Massimo's > mail) >
[web2py] Re: web2py slides from pycon argentina (spanish)
Congratulations Martín. Your talk was very good. And thanks for sharing your knowledge for enhancing web2py apps. Regards On Sep 24, 11:25 am, Martín Mulone wrote: > web2py slides from pycon argentina (spanish) > > -- > http://martin.tecnodoc.com.ar > > pensandoengrande.pdf > 1139KViewDownload
[web2py] Re: criticism of web2py
Most of the criticism is fueled by stakeholders in other python frameworks. Even if those are open source projects, they have consulting based on their frameworks (and that is perfectly reasonable) therefore when another framework steals their customers and wins awards they see it as a bad thing. There may also be a component of cognitive dissonance: http://en.wikipedia.org/wiki/The_Fox_and_the_Grapes In fact some of the people who have criticized web2py the most did not have a formal eduction in CS or have not yet completed a graduate degree and live the belief that school is not necessary as industry is more advanced than academia. While I do agree that a person who does not have a formal education can be smarter, know more, and accomplish more than a person who did spend long time in school, statistically that is not that case. Moreover even if academia is often not as well organized and focused as industry, some of the most innovative ideas came from academia and government funded research. People in academia are motivated by the desire to push science and technology forward as opposed by the immediate need to generate profit. The open source movement started from the academic/research world and has been fueled by that. The adoption of open source by industry is a recent trend. I remember giving a talk 10 years ago trying to convince business people that it is a good idea to use open source. That is why it bothers me that some of the people in industry who have profited from (and contributed to) open source, look down to projects originating from academia. Massimo On Sep 25, 2:55 am, Gour-Gadadhara Dasa wrote: > Hello! > > I'm starting with python & web2py and yesterday visited > Hello, > > I'm starting with Python & Web2Py and yesterday visited one python-related > project channel where I mentioned web2py and as the consequence I was quickly > advised to abandon it due to 'non-Pythonic' etc. > > This is not the first time I hear people criticise web2py due to, amongst > other > things, breaking "Explicit is better than implicit." principle alothough > Massimo nicely explains it in the introduction of web2py book. > > I played for sometime with the Haskell, but eventuall abandon it due to not > being pragmatic enough for daily use (e.g. all GUI bindings are maintained by > few people only). The same situation was/is with D. > > Now, I see Python as very pragmatic language, with lot of 'batteries included' > and very suitable for all kinds of tasks, so I wonder waht is the real reason > of web2py criticism: > > a) stubborness of (python) people to see that "Explicit is better than > implicit." is not engraved in stone and can be violated to keep DRY, > > b) envy of web2py's success > > c) something else? > > As far as I'm concerned, I do not care much 'cause I'm accustomed to do things > which are not mainstream, but just curios what do you think? > > Sincerely, > Gour > > -- > “In the material world, conceptions of good and bad are > all mental speculations…” (Sri Caitanya Mahaprabhu) > > http://atmarama.net| Hlapicina (Croatia) | GPG: 52B5C810 > > signature.asc > < 1KViewDownload
[web2py] Re: web2py handlers
You are running from source and need to install the Mark Hamming win32 extensions. On Sep 25, 5:12 am, Web2Py Freak wrote: > Dear All , > > hey guys , when i run web2py on windows from source with my own > python it keeps giving me this : > > No handlers could be found for logger "web2py" ,, > > why ?? what to do ? it keeps giving me a warning like this : > > WARNING:web2py.cron:WB2PY CRON : Disabled because no file > locking ...
[web2py] Re: table, grid, smartgrid, getting better
You should thank Bruno and Martin for this feature. ;-) On Sep 25, 7:22 am, Ivica Kralj wrote: > Thanks Massimo. > > On 25 September 2011 00:02, Massimo Di Pierro > wrote: > > > > > > > > > Yes they are: > > > grid=SQLFORM.smartgrid(db.person,ui='jquery-ui') > > > On Sep 24, 12:48 pm, Ivica Kralj wrote: > > > Hi, > > > > I'm quite impressed with the features in this release (also it didn't > > break > > > anything :) ) > > > > Just a question for Martin or Bruno, or anybody who knows the answer > > > regarding smartrgid/grid and Jquery UI themes application. I've spent few > > > hours searching through this group and couldn't find the answer. > > > > Are Jquery UI themes supported by default in grid/smartgrid (I know there > > > was talk about this but no sure if it's implemented) and if not how to > > > activate it? I've seen there is a patch, but again not sure if it was > > > applied to latest release. > > > > I tried few variation, and I'm running out ideas (last option is to check > > > the code, but posting this question here might be faster and beneficial > > to > > > other users) > > > > grid=SQLFORM.smartgrid(db.person,jqueryui=True) ##wrong, do not > > use### > > > > For example in this demo Jquery UI css is used. > > > >http://labs.blouweb.com/web2pygrid/default/index?jqueryui=true > > > > > > While in my app using smartgrid html looks like this > > > > > > > Thanks > > > I > > > > On 24 August 2011 11:13, Bruno Rocha wrote: > > > > > JqueryUI Applied! (Any Theme fromhttp://jqueryui.com/themeroller) > > > > > Take a look in attached screenshots (a patch is comming to Massimo's > > mail)
RE: [web2py] Re: 1.99.1 and ssl/https
Sorry Massimo I forgot the cert/cert switches on the commandline shortcut after upgrading- so this was due to my mistake. For testing purposes I just now ran the following line without errors: Web2py.exe -c cert.crt -k cert.key -p p And I was able to run ssl on port 80 with no issues. I tried to recreate possible errors that others might have but the only thing I could do was to remove the s from https and then got a short error message in the console (rocket.errors.port800) which is to be expected I suppose. Resuming the https, everything worked fine - server keept running without issue. I am not doing anything fancy with routes or anything. Win7-64, python 2.7.2, web2py 1.99.1, self signed cert, rocket/web2py web server -Original Message- From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of Massimo Di Pierro Sent: Sunday, September 25, 2011 2:22 AM To: web2py-users Subject: [web2py] Re: 1.99.1 and ssl/https Can you help us debug this? Do you get this error with 1.99.1 and not with 1.98.2? Could it be related to this: http://stackoverflow.com/questions/2538723/ssl-received-a-record-that-exceed ed-the-maximum-permissible-length-error-code Massimo On Sep 24, 9:47 pm, "Cameron" wrote: > Just tried ssl via the admin console. > > Running windows 7 64 with 32 bit (I think) python 2.7.2. > > Got this in firefox version 6.x: > "" > Secure Connection Failed > An error occurred during a connection to 127.0.0.1:8000. > SSL received a record that exceeded the maximum permissible length. > (Error code: ssl_error_rx_record_too_long) "" > > Got this in chrome: > "" > Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error. > "" > > Opera just sits with the hour glass running. > > IE doesn't say much of anything, but the site doesn't come up. > > Works great without ssl. > > Can't find any error log entry in the admin app error page. I'm a > beginner with web2py but I can do a packet capture if you tell me where to send it. > > > > > > > > -Original Message- > From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On > Behalf Of > > Massimo Di Pierro > Sent: Saturday, September 24, 2011 8:02 PM > To: web2py-users > Subject: [web2py] 1.99.1 and ssl/https > > Has anybody tried 1.99.1 with https (other thank Dirk)? We have a > strange error logged and we cannot get to the bottom of it. Perhaps if > you have tried on other OSes/Python version it can help us narrow it > downs. It seems to work even if the error is logged. > > Massimo
[web2py] Re: 1.99.1 and ssl/https
Thanks this thread is heling me a lot. On Sep 25, 11:00 am, "Cameron" wrote: > Sorry Massimo I forgot the cert/cert switches on the commandline shortcut > after upgrading- so this was due to my mistake. > > For testing purposes I just now ran the following line without errors: > > Web2py.exe -c cert.crt -k cert.key -p p > > And I was able to run ssl on port 80 with no issues. > > I tried to recreate possible errors that others might have but the only > thing I could do was to remove the s from https and then got a short error > message in the console (rocket.errors.port800) which is to be expected I > suppose. > > Resuming the https, everything worked fine - server keept running without > issue. I am not doing anything fancy with routes or anything. > > Win7-64, python 2.7.2, web2py 1.99.1, self signed cert, rocket/web2py web > server > > > > > > > > -Original Message- > From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of > > Massimo Di Pierro > Sent: Sunday, September 25, 2011 2:22 AM > To: web2py-users > Subject: [web2py] Re: 1.99.1 and ssl/https > > Can you help us debug this? Do you get this error with 1.99.1 and not with > 1.98.2? Could it be related to > this:http://stackoverflow.com/questions/2538723/ssl-received-a-record-that... > ed-the-maximum-permissible-length-error-code > > Massimo > > On Sep 24, 9:47 pm, "Cameron" wrote: > > Just tried ssl via the admin console. > > > Running windows 7 64 with 32 bit (I think) python 2.7.2. > > > Got this in firefox version 6.x: > > "" > > Secure Connection Failed > > An error occurred during a connection to 127.0.0.1:8000. > > SSL received a record that exceeded the maximum permissible length. > > (Error code: ssl_error_rx_record_too_long) "" > > > Got this in chrome: > > "" > > Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error. > > "" > > > Opera just sits with the hour glass running. > > > IE doesn't say much of anything, but the site doesn't come up. > > > Works great without ssl. > > > Can't find any error log entry in the admin app error page. I'm a > > beginner with web2py but I can do a packet capture if you tell me where to > send it. > > > -Original Message- > > From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On > > Behalf Of > > > Massimo Di Pierro > > Sent: Saturday, September 24, 2011 8:02 PM > > To: web2py-users > > Subject: [web2py] 1.99.1 and ssl/https > > > Has anybody tried 1.99.1 with https (other thank Dirk)? We have a > > strange error logged and we cannot get to the bottom of it. Perhaps if > > you have tried on other OSes/Python version it can help us narrow it > > downs. It seems to work even if the error is logged. > > > Massimo
[web2py] Re: Help Getting Cron Task to run
Well I just realized that */1 * * * * python /home/www-data/web2py/web2py.py -S sos_test -M -N - R applications/sos_test/private/scripts/ctest.py has the -N in it which would stop crontab from running. I removed that but it's still not working. I tried setting SOFTCRON = True And then tried all my variations again but to no avail. There has to be something I'm doing wrong. Any ideas out there? On Sep 24, 3:47 pm, Lennon wrote: > I also just tried: > > */1 * * * * python /home/www-data/web2py/web2py.py -S sos_test -M -N - > R applications/sos_test/private/scripts/ctest.py > > and > > */1 * * * * python /home/www-data/web2py/web2py.py -S sos_test -M -N - > R /private/scripts/ctest.py > > I also noticed that my crontab file doesn't have a file extension. Is > that correct? > > On Sep 24, 3:33 pm,Lennon wrote: > > > > > > > > > I'm still not able to get this to run. I even tried restarting apache > > but to no avail. > > > */1 * * * * python /home/www-data/web2py/web2py.py -J -S my_app_name - > > R /cron/ctest.py > > > ctest.py looks like this and runs fine in the command line on the > > server: > > > FILE = open("pytest.txt","w") > > FILE.writelines('cronification') > > FILE.close() > > > Any ideas? > > > On Sep 23, 11:38 am, Ross Peoples wrote: > > > > You typically need to run it in the web2py environment (use absolute > > > paths): > > > > */1 * * * * python /path/to/web2py/web2py.py -J -S app_name -R > > > /path/to/script > > > > You could also add something like "2&1> /path/to/log.log" so that output > > > gets put into a log file in case there's an error in your script.
[web2py] Changing header picture
Hello, I have built an combined internet and intranet application for an customer. Internet pages are modified by an very, very CMS that I have built. Layouten is simple, header picture, meny on the left and content to the right. Yesterday customer asked if it would be possible to change the header picture so that differfent pages has different header pictures. If no header picture given for an page an default picture would be used. Even that default picture they would like to be able to change. Should I just out some python code inte layout.html that fetches the picture for an specific page and if not found uses the default one. Or is there an easier way, maybe without using database for this? Kenneth
[web2py] Re: 1.99.1 and ssl/https
I have a development environment set up, based on openvz virtual machines. Basically, I can fire up any linux os in a matter of seconds... Well, minutes, if I need to download the OS template first and than add web2py. Any of the templates are possible: http://download.openvz.org/template/precreated/ So, any combination of OS-es or python versions that you'd like to check for a specific error, just drop a note. On Sunday, September 25, 2011 6:03:38 PM UTC+2, Massimo Di Pierro wrote: > > Thanks this thread is heling me a lot. > > >
[web2py] Haml + Sass (or Scss) Would be so lovely
Please integrates this technologies in web2py ! It will become a super fast framework for prototyping webapps
[web2py] Console Shows Cron Startup Threading Error after installing win32 python extention
When I running web2py locally on my windows 7 machine I was getting this in the console: Starting hardcron... WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking I found this thread: http://comments.gmane.org/gmane.comp.python.web2py/43243 and proceeded to instal the win32 extension (for python 2.7) that Massimo linked to. Now I'm getting the following: Starting hardcron... Exception in thread Thread-5: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 552, in __bootstrap_inner self.run() File "C:\Users\Sony\workspace\web2py\gluon\newcron.py", line 220, in run shell=self.shell) File "C:\Python27\lib\subprocess.py", line 679, in __init__ errread, errwrite) File "C:\Python27\lib\subprocess.py", line 893, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified Then next it'll say: Exception in thread Thread-6: (Same error as thread-5) and so on.
[web2py] Re: Changing header picture
I'd say program it or use a block: http://web2py.com/book/default/chapter/05#Blocks-in-Views
[web2py] Where do I put custom class files?
Where should I put files with custom python classes to take care of business logic (and get it out of my controllers)? Do I have to set these up as a module and import them into th controller or will the classes automatically be available to any controller? Thanks, Ian
[web2py] postgresql DAL connection issue
hello one and all, i am having difficultly connecting postgres 9.1 under web2py v1.98.2 on a centos 6.0 box which has python 2.6.5. i have psycopg2 2.4 installed and working in python when i run the test #python2.6 web2py -S welcom -N -a 'password' then >import psycopg2 > works just fine. however, when i put db = DAL('postgres://postgres:passwd@localhost:5432/prac2') and attempt to click on database administrator, i get for the traceback Traceback (most recent call last): File "/opt/web-apps/web2py/gluon/restricted.py", line 192, in restricted exec ccode in environment File "/opt/web-apps/web2py/applications/prac2_with_postgresql/models/ db.py", line 83, in db = DAL('postgres://root:@localhost:5432/prac2') File "/opt/web-apps/web2py/gluon/dal.py", line 3981, in __init__ raise RuntimeError, "Failure to connect, tried %d times:\n%s" % (attempts, error) RuntimeError: Failure to connect, tried 5 times: could not connect to server: Permission denied Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? any ideas on what i have not done properly??? thank you in advance and have a great day. lucas
[web2py] Re: Where do I put custom class files?
Modules have to be imported -- only classes/objects defined in model files are available in all controllers (and views). Note, by default, the web2py globals (i.e., request, response, session, validators, HTML helpers) will not be available in your modules, so you either have to pass them in as arguments to classes/functions, or use the new thread local 'current' object. For some examples of the latter, see http://martin.tecnodoc.com.ar/default/post/2011/09/12/7_optimize-your-web2py-app-using-the-new-import-method. Anthony On Sunday, September 25, 2011 3:28:45 PM UTC-4, monotasker wrote: > > Where should I put files with custom python classes to take care of > business logic (and get it out of my controllers)? Do I have to set these up > as a module and import them into th controller or will the classes > automatically be available to any controller? > > Thanks, > > Ian > >
[web2py] Re: Where do I put custom class files?
Thanks. A couple of points of clarification: 1. Are the global web2py objects (session etc.) available to classes defined in a model file? 2. You mentioned the option of writing modules to import. What's the best location for these? In the 'static' directory?
[web2py] Re: Haml + Sass (or Scss) Would be so lovely
web2py mostly deals with serverside. I do not think these tools belong to the scaffolding app because it is important that new uses can understanding with only basic knowledge of python+html+css and nothing more. Anyway, feel free to create a plugin for HTML+SASS and I will be happy to post it. It is a good exercise to build such plugin and should not take more than few minutes. On Sep 25, 12:43 pm, Alexandre Strzelewicz wrote: > Please integrates this technologies in web2py ! > It will become a super fast framework for prototyping webapps
[web2py] xml in response not well formed
Hello All, sorry for the bother I am having an issue with Version 1.99.1 (2011-09-22 16:59:24) stable release. It seems to be that there are some problems when parsing the .xml view file, not sure. I have a function (device_cfg) in controllers/default.py, which performs some processing and pass to the view the following dictionary: return dict(operation=operation, op_response=op_response) with: operation = "get_leafs" op_response = "True" The following code is the view (device_cfg.xml): {{if operation == 'get_containers':}} {{parent_id = op_response['parent_id']}} {{childs_list = op_response['childs_list']}} {{for node in childs_list:}} {{pass}} {{pass}} {{if operation == 'get_leafs':}} {{limit = op_response['limit']}} {{parent_id = op_response['parent_id']}} {{childs_list = op_response['childs_list']}} {{page = op_response['page']}} {{start = op_response['start']}} {{iter = op_response['iter']}} {{total_pages = op_response['total_pages']}} {{ =page }} {{ =total_pages }} {{ =len(childs_list) }} {{for i in iter:}} {{node = childs_list[i]}} {{=node[0]}} {{=node[1]}} {{=node[2]}} {{pass}} {{pass}} {{if operation == 'leaf_remove':}} {{=op_response}} {{pass}} {{if operation == 'leaf_create':}} {{=op_response}} {{pass}} {{if operation == 'leaf_modify':}} {{=op_response}} {{pass}} {{if operation == 'container_remove':}} {{=op_response}} {{pass}} {{if operation == 'container_create':}} {{=op_response}} {{pass}} {{if operation == 'container_edit':}} {{=op_response}} {{pass}} {{if operation == 'validate_commit':}} {{=op_response[0]}} {{=op_response[1]}} {{pass}} {{if operation == 'validate_commit_cancel':}} {{=op_response}} {{pass}} {{if operation == 'get_ns_map':}} {{=1}} {{=1}} {{=len(op_response)}} {{i=0}} {{for ns in op_response:}} {{=ns}} {{i += 1}} {{pass}} {{pass}} {{if operation == 'push_config':}} {{=op_response[0]}} {{=op_response[1]}} {{pass}} The expected replied xml is: True But it returns: True 1.0 2 2 ns1:max-lease-time asds 3 ns1:default-lease-time 600 Firefox is complaining with the following error code: "XML Parsing Error: junk after document element Location: moz-nullprincipal: {c9878540-af47-407f-b97b-4709a9fcecdf} Line Number 26, Column 3: 1.0". I have checked the view several times and I am not able to figure out what is going on. Could someone please help me?... Any help will be appreciated! Regards, Tincho
[web2py] Re: xml in response not well formed
I appologize: the variables passed to the view are: operation = "leaf_modify" op_response = "True" Tincho
Re: [web2py] xml in response not well formed
FWIW, it looks to me like the extra lines are left over from a previous response (or something like that) and not being generated by this particular invocation of the view. Why that would happen I have no idea. On Sep 25, 2011, at 2:38 PM, Martin wrote: > Hello All, sorry for the bother I am having an issue with Version > 1.99.1 (2011-09-22 16:59:24) stable release. It seems to be that there > are some problems when parsing the .xml view file, not sure. I have a > function (device_cfg) in controllers/default.py, which performs some > processing and pass to the view the following > dictionary: > > return dict(operation=operation, op_response=op_response) > > with: > operation = "get_leafs" > op_response = "True" > > The following code is the view (device_cfg.xml): > > > {{if operation == 'get_containers':}} > {{parent_id = op_response['parent_id']}} > {{childs_list = op_response['childs_list']}} > > {{for node in childs_list:}} >state="closed"> > > > > > {{pass}} > > {{pass}} > > {{if operation == 'get_leafs':}} > {{limit = op_response['limit']}} > {{parent_id = op_response['parent_id']}} > {{childs_list = op_response['childs_list']}} > {{page = op_response['page']}} > {{start = op_response['start']}} > {{iter = op_response['iter']}} > {{total_pages = op_response['total_pages']}} > > > {{ =page }} > {{ =total_pages }} > {{ =len(childs_list) }} > {{for i in iter:}} > {{node = childs_list[i]}} > > {{=node[0]}} > {{=node[1]}} > {{=node[2]}} > > {{pass}} > > {{pass}} > > {{if operation == 'leaf_remove':}} > {{=op_response}} > {{pass}} > > {{if operation == 'leaf_create':}} > {{=op_response}} > {{pass}} > > {{if operation == 'leaf_modify':}} > {{=op_response}} > {{pass}} > > {{if operation == 'container_remove':}} > {{=op_response}} > {{pass}} > > {{if operation == 'container_create':}} > {{=op_response}} > {{pass}} > > {{if operation == 'container_edit':}} >{{=op_response}} > {{pass}} > > {{if operation == 'validate_commit':}} > >{{=op_response[0]}} >{{=op_response[1]}} > > {{pass}} > > {{if operation == 'validate_commit_cancel':}} >{{=op_response}} > {{pass}} > > {{if operation == 'get_ns_map':}} > > {{=1}} > {{=1}} > {{=len(op_response)}} > {{i=0}} > {{for ns in op_response:}} > > {{=ns}} > > >{{i += 1}} >{{pass}} > > {{pass}} > > {{if operation == 'push_config':}} > >{{=op_response[0]}} >{{=op_response[1]}} > > {{pass}} > > > The expected replied xml is: > > > True > > But it returns: > > > True > 1.0 > 2 > > 2 > ns1:max-lease-time > asds > > > 3 > ns1:default-lease-time > 600 > > > > Firefox is complaining with the following error code: "XML Parsing > Error: junk after document element Location: moz-nullprincipal: > {c9878540-af47-407f-b97b-4709a9fcecdf} Line Number 26, Column 3: > 1.0". > > I have checked the view several times and I am not able to figure out > what is going on. Could someone please help me?... > > Any help will be appreciated! > > Regards, > Tincho
[web2py] Re: Creating a Layout Plugin
Hi again, The swapping out of the views/layout.html appears to happen automatically for the downloaded layouts, but it doesn't for my layout plugin. I've followed the same naming and folder standards. What have I missed ? Thanks Andrew W On Sep 25, 5:45 pm, Andrew wrote: > Thanks Massimo, > It is a good convention to keep consistency across many layouts, so > I'll do the same. > Regards > Andrew > > On Sep 25, 12:56 pm, Massimo Di Pierro > wrote: > > > > > Good point. The name of the plugin (after installed) is not determined > > by the filename (w2p) but determined by the file content of the w2p > > file. > > > I used the convention to put all layout as subfolder so a > > plugin_layouts so > > > web2py.plugin.layout_xxx.w2p would contain > > views/layout.html > > views/plugin_layouts/xxx/layout.html > > static/plugin_layouts/xxx/* > > > This allows me to install multiple layouts and swamp them by replacing > > views/layout.html > > with > > views/plugin_layouts/xxx/layout.html > > > Massimo > > > On Sep 24, 6:48 pm, Andrew wrote: > > > > Hi, > > > I'm trying to create a layout plugin, and I'm using the existing > > > layouts atwww.web2py.com/layoutsasaguide. > > > I've noticed that they have names like web2py.plugin.layout_Name.w2p > > > but when I install them they are all called "plugin_layouts". > > > > I'm guessing the plugin name in the w2p file was changed, or manually > > > created with tar (from another post). Were they all developed with > > > the name "plugin_layouts". I don't see that naming convention > > > mentioned anywhere. > > > > So, to follow the convention, should I develop my layout by calling it > > > plugin_layouts and following the folder and naming conventions of the > > > other layouts, and then rename the packed file from > > > web2py.plugin.plugin_layouts.w2p to > > > web2py.plugin_layout_MyFancyLayoutName.w2p ? > > > > Thanks > > > > Andrew W- Hide quoted text - > > - Show quoted text -
[web2py] Re: xml in response not well formed
yes, you are right, because the variables for the following xml part it suppose to be not available for current request, which corresponds to operation == 'get_leafs'... 1.0 2 2 ns1:max-lease-time asds 3 ns1:default-lease-time 600
Re: [web2py] Re: xml in response not well formed
On Sep 25, 2011, at 3:52 PM, Martin wrote: > yes, you are right, because the variables for the following xml part > it suppose to be not available for current request, which corresponds > to operation == 'get_leafs'... Can you get a look at the Content-length header of the response? > > 1.0 > 2 > > 2 > ns1:max-lease-time > asds > > > 3 > ns1:default-lease-time > 600 > >
[web2py] Re: xml in response not well formed
Response Headers X-Powered-Byweb2py Set-Cookie session_id_nems_web=127.0.0.1-1c024dc8-7db7-440c-a45e- d57de93d8879; Path=/ Expires Sun, 25 Sep 2011 23:30:33 GMT Pragma no-cache Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre- check=0 Content-Typeapplication/xml DateSun, 25 Sep 2011 23:30:33 GMT Server Rocket 1.2.4 Python/2.7.1+ Content-Length 85 Connection keep-alive
Re: [web2py] Re: xml in response not well formed
On Sep 25, 2011, at 4:32 PM, Martin wrote: > Response Headers > X-Powered-By web2py > Set-Cookiesession_id_nems_web=127.0.0.1-1c024dc8-7db7-440c-a45e- > d57de93d8879; Path=/ > Expires Sun, 25 Sep 2011 23:30:33 GMT > Pragmano-cache > Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre- > check=0 > Content-Type application/xml > Date Sun, 25 Sep 2011 23:30:33 GMT > ServerRocket 1.2.4 Python/2.7.1+ > Content-Length85 > Connectionkeep-alive Well, that's interesting. There are certainly more than 85 characters in the content you originally quoted. It might be worth trying another browser, if you can.
[web2py] Re: xml in response not well formed
I tested with Chrome and I don't have the issue... so, it seems to be that it's in the Firefox side... this is really weird... Thank you very much for your help Jonathan, I will include a restriction to open the application just with Chrome... Much appreciated! Martin
[web2py] Re: Where do I put custom class files?
On Sunday, September 25, 2011 3:55:56 PM UTC-4, monotasker wrote: > > Thanks. A couple of points of clarification: > 1. Are the global web2py objects (session etc.) available to classes > defined in a model file? > Yes, if you define a class in a model, all the web2py globals would be available. One thing to note, because models are executed by the framework, make sure your classes do not include a __del__ method, as that can cause a memory leak. > 2. You mentioned the option of writing modules to import. What's the best > location for these? In the 'static' directory? You should put modules in /myapp/modules. If you have /myapp/modules/mymodule.py, then all you have to do to import it is 'import mymodule.py', and the web2py custom importer will look in the application's 'modules' folder before checking the rest of sys.path. Anthony
[web2py] Re: Where do I put custom class files?
I thought it was just "import mymodule"? And can you do "from mymodule import myfunc"?
[web2py] Re: Where do I put custom class files?
On Sunday, September 25, 2011 8:08:53 PM UTC-4, pbreit wrote: > > I thought it was just "import mymodule"? Yes, of course it is -- lack of proofreading. > > And can you do "from mymodule import myfunc"? > As far as I know. Anthony
[web2py] Re: Where do I put custom class files?
This is great. Thanks again Anthony. I'm surprised that this approach doesn't seem to be well documented in the (generally outstanding) web2py book. Is it not encouraged as 'the web2py way' or is it taken for granted that people with Python knowledge can figure it out? (Or have I just missed it in there?) Ian
[web2py] Re: Where do I put custom class files?
Both the custom importer and the 'current' object are relatively new (added since book's last major revision), so they're not documented yet (except in this mailing list). Prior to that, it was of course possible to use modules, but not quite as easy. The book will be revised soon, so these things will be documented. Anthony On Sunday, September 25, 2011 9:32:24 PM UTC-4, monotasker wrote: > > This is great. Thanks again Anthony. > > I'm surprised that this approach doesn't seem to be well documented in the > (generally outstanding) web2py book. Is it not encouraged as 'the web2py > way' or is it taken for granted that people with Python knowledge can figure > it out? (Or have I just missed it in there?) > > Ian > >
[web2py] Re: Creating a Layout Plugin
If you want that to happen you have to include the views/layout.html in the plugin You cannot do that using the web interface. You you have to do it manually cd web2py/applications/app tar zcvf ../web2py.plugins.layout_name.w2p views/layout.html views/ plugin_layouts/* static/plugin_layouts/* On Sep 25, 5:43 pm, Andrew wrote: > Hi again, > The swapping out of the views/layout.html appears to happen > automatically for the downloaded layouts, but it doesn't for my layout > plugin. I've followed the same naming and folder standards. > > What have I missed ? > > Thanks > > Andrew W > > On Sep 25, 5:45 pm, Andrew wrote: > > > > > > > > > Thanks Massimo, > > It is a good convention to keep consistency across many layouts, so > > I'll do the same. > > Regards > > Andrew > > > On Sep 25, 12:56 pm, Massimo Di Pierro > > wrote: > > > > Good point. The name of the plugin (after installed) is not determined > > > by the filename (w2p) but determined by the file content of the w2p > > > file. > > > > I used the convention to put all layout as subfolder so a > > > plugin_layouts so > > > > web2py.plugin.layout_xxx.w2p would contain > > > views/layout.html > > > views/plugin_layouts/xxx/layout.html > > > static/plugin_layouts/xxx/* > > > > This allows me to install multiple layouts and swamp them by replacing > > > views/layout.html > > > with > > > views/plugin_layouts/xxx/layout.html > > > > Massimo > > > > On Sep 24, 6:48 pm, Andrew wrote: > > > > > Hi, > > > > I'm trying to create a layout plugin, and I'm using the existing > > > > layouts atwww.web2py.com/layoutsasaguide. > > > > I've noticed that they have names like web2py.plugin.layout_Name.w2p > > > > but when I install them they are all called "plugin_layouts". > > > > > I'm guessing the plugin name in the w2p file was changed, or manually > > > > created with tar (from another post). Were they all developed with > > > > the name "plugin_layouts". I don't see that naming convention > > > > mentioned anywhere. > > > > > So, to follow the convention, should I develop my layout by calling it > > > > plugin_layouts and following the folder and naming conventions of the > > > > other layouts, and then rename the packed file from > > > > web2py.plugin.plugin_layouts.w2p to > > > > web2py.plugin_layout_MyFancyLayoutName.w2p ? > > > > > Thanks > > > > > Andrew W- Hide quoted text - > > > - Show quoted text -
[web2py] Re: table, grid, smartgrid, getting better
That would better if add Ajax Globel serch in that. I impressed with the power table plug in search . On Sep 24, 10:48 pm, Ivica Kralj wrote: > Hi, > > I'm quite impressed with the features in this release (also it didn't break > anything :) ) > > Just a question for Martin or Bruno, or anybody who knows the answer > regarding smartrgid/grid and Jquery UI themes application. I've spent few > hours searching through this group and couldn't find the answer. > > Are Jquery UI themes supported by default in grid/smartgrid (I know there > was talk about this but no sure if it's implemented) and if not how to > activate it? I've seen there is a patch, but again not sure if it was > applied to latest release. > > I tried few variation, and I'm running out ideas (last option is to check > the code, but posting this question here might be faster and beneficial to > other users) > > grid=SQLFORM.smartgrid(db.person,jqueryui=True) ##wrong, do not use### > > For example in this demo Jquery UI css is used. > > http://labs.blouweb.com/web2pygrid/default/index?jqueryui=true > > While in my app using smartgrid html looks like this > > > Thanks > I > > On 24 August 2011 11:13, Bruno Rocha wrote:> JqueryUI > Applied! (Any Theme fromhttp://jqueryui.com/themeroller) > > > Take a look in attached screenshots (a patch is comming to Massimo's mail)
Re: [web2py] postgresql DAL connection issue
Can you test: #python2.6 >import psycopg2 >psycopg2.connect(database="prac2", user="postgres", password="password", >host="localhost") Maybe the server is down, you have a firewall issue or your pg_hba.conf is not open for localhost connections: hostall all 127.0.0.1 md5 hostsslall all 127.0.0.1 md5 (use 127.0.0.1 as ipv6 localhost address may conflict) Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Sun, Sep 25, 2011 at 4:06 PM, lucas wrote: > hello one and all, > > i am having difficultly connecting postgres 9.1 under web2py v1.98.2 > on a centos 6.0 box which has python 2.6.5. i have psycopg2 2.4 > installed and working in python when i run the test > > #python2.6 web2py -S welcom -N -a 'password' > then >>import psycopg2 >> > > works just fine. however, when i put > > db = DAL('postgres://postgres:passwd@localhost:5432/prac2') > > and attempt to click on database administrator, i get for the > traceback > > Traceback (most recent call last): > File "/opt/web-apps/web2py/gluon/restricted.py", line 192, in > restricted > exec ccode in environment > File "/opt/web-apps/web2py/applications/prac2_with_postgresql/models/ > db.py", line 83, in > db = DAL('postgres://root:@localhost:5432/prac2') > File "/opt/web-apps/web2py/gluon/dal.py", line 3981, in __init__ > raise RuntimeError, "Failure to connect, tried %d times:\n%s" % > (attempts, error) > RuntimeError: Failure to connect, tried 5 times: > could not connect to server: Permission denied > Is the server running on host "localhost" (127.0.0.1) and > accepting > TCP/IP connections on port 5432? > > any ideas on what i have not done properly??? thank you in advance > and have a great day. lucas
[web2py] Re: Creating a Layout Plugin
Thankyou. On Sep 26, 3:49 pm, Massimo Di Pierro wrote: > If you want that to happen you have to include the views/layout.html > in the plugin You cannot do that using the web interface. You you have > to do it manually > > cd web2py/applications/app > tar zcvf ../web2py.plugins.layout_name.w2p views/layout.html views/ > plugin_layouts/* static/plugin_layouts/* > > On Sep 25, 5:43 pm, Andrew wrote: > > > > > Hi again, > > The swapping out of the views/layout.html appears to happen > > automatically for the downloaded layouts, but it doesn't for my layout > > plugin. I've followed the same naming and folder standards. > > > What have I missed ? > > > Thanks > > > Andrew W > > > On Sep 25, 5:45 pm, Andrew wrote: > > > > Thanks Massimo, > > > It is a good convention to keep consistency across many layouts, so > > > I'll do the same. > > > Regards > > > Andrew > > > > On Sep 25, 12:56 pm, Massimo Di Pierro > > > wrote: > > > > > Good point. The name of the plugin (after installed) is not determined > > > > by the filename (w2p) but determined by the file content of the w2p > > > > file. > > > > > I used the convention to put all layout as subfolder so a > > > > plugin_layouts so > > > > > web2py.plugin.layout_xxx.w2p would contain > > > > views/layout.html > > > > views/plugin_layouts/xxx/layout.html > > > > static/plugin_layouts/xxx/* > > > > > This allows me to install multiple layouts and swamp them by replacing > > > > views/layout.html > > > > with > > > > views/plugin_layouts/xxx/layout.html > > > > > Massimo > > > > > On Sep 24, 6:48 pm, Andrew wrote: > > > > > > Hi, > > > > > I'm trying to create a layout plugin, and I'm using the existing > > > > > layouts atwww.web2py.com/layoutsasaguide. > > > > > I've noticed that they have names like web2py.plugin.layout_Name.w2p > > > > > but when I install them they are all called "plugin_layouts". > > > > > > I'm guessing the plugin name in the w2p file was changed, or manually > > > > > created with tar (from another post). Were they all developed with > > > > > the name "plugin_layouts". I don't see that naming convention > > > > > mentioned anywhere. > > > > > > So, to follow the convention, should I develop my layout by calling it > > > > > plugin_layouts and following the folder and naming conventions of the > > > > > other layouts, and then rename the packed file from > > > > > web2py.plugin.plugin_layouts.w2p to > > > > > web2py.plugin_layout_MyFancyLayoutName.w2p ? > > > > > > Thanks > > > > > > Andrew W- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -
[web2py] web2py 1.99.2 is OUT
No changes from 1.99.1 but a couple of bug fixes. I am listing again the 1.99.1 change log: - gluon/contrib/simplejsonrpc.py - gluon/contrib/redis_cache.py - support for A(name,callback=url,target='id',delete='tr') - support for A(name,component=url,target='id',delete='tr') - new pip installer, thanks Chris Steel - isapiwsgihandler.py - dal expression.coalesce(*options) - gluon/contrib/simplejsonrpc.py, thanks Mariano - expire_sessions.py respects expiration time, thanks iceberg - addressed this issue: http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/ - x509 support (thanks Michele) - form.process() and for.validate() - rocket upgrade (1.2.4) - jQuery upgrade (1.6.3) - new syntax rows[i]('tablename.fieldname') - new query syntax field.contains(list,all=True or False) - new SQLFORM.grid and SQLFORM.smartgrid (should replace crud.search and crud.select) - support for natural language queries (english only) in SQLFORM.grid - support for computed columns and additional links in SQLFORM.grid - new style virtual fields (experimental): db.table.field=Field.Lazy(...) - request.utcnow - cleaner/simpler welcome/models/db.py and welcome layout.html - response.include_meta() and response.include_files(), thanks Denes - dal auto-reconnect on time-out connections - COL and COLGROUP helpers - addresed OWASP #10, thanks Anthony and Eric - auth.settings.login_after_registration=True - detection of mobile devices and @mobilize helper (view.mobile.html), thanks Angelo - experimental gluon/scheduler.py - scripts/make_min_web2py.py - crud.search has more options, thanks Denes - many bug fixes (thanks Jonathan, Michele, Fran and others) You can try the SQLFORM.smartgrid here: https://labs.blouweb.com/bootstrap
[web2py] web2py with twitter bootstrap - very clean interface ...
http://labs.blouweb.com/bootstrap/default/index
[web2py] Re: Where do I put custom class files?
I use a custom 3rd party class (named 'dabo') in web2py. Is there any catch if I keep the class in /web2py/site-packages ? Earlier I had kept the same in /myapp/modules folder. But it could not be imported in model files. So I shifted it to /web2py/site-packages. With this, I can import the class 'dabo' in model files. ---Vineet On Sep 26, 7:36 am, Anthony wrote: > Both the custom importer and the 'current' object are relatively new (added > since book's last major revision), so they're not documented yet (except in > this mailing list). Prior to that, it was of course possible to use modules, > but not quite as easy. The book will be revised soon, so these things will > be documented. > > Anthony > > > > On Sunday, September 25, 2011 9:32:24 PM UTC-4, monotasker wrote: > > > This is great. Thanks again Anthony. > > > I'm surprised that this approach doesn't seem to be well documented in the > > (generally outstanding) web2py book. Is it not encouraged as 'the web2py > > way' or is it taken for granted that people with Python knowledge can figure > > it out? (Or have I just missed it in there?) > > > Ian- Hide quoted text - > > - Show quoted text -
Re: [web2py] web2py 1.99.2 is OUT
This is the right link to try the grid : http://labs.blouweb.com/web2pygrid The other is twitter bootstrap app
[web2py] Signature apps
I have not tested them and I am sure I am missing something important so please add below (do not comment, just add to the list) Layouts and Plugin Layouts == http://web2py.com/layouts http://web2py.com/drupal (converted from Drupal) http://web2py.com/zengarden (then press top-left button) Plugins == Plugin wiki: http://web2py.com/examples/static/web2py.plugin.wiki.w2p http://dev.s-cubism.com/web2py_plugins http://code.google.com/p/web2py-plugins or http://web2py.com/plugins http://sramana.in/web2py-instant-admin/ https://bitbucket.org/mulonemartin/powerpack/wiki/Home http://web2py.com/plugins/plugin_jqmobile/about (jquery.mobile plugin) CMS http://code.google.com/p/cube2py/ http://code.google.com/p/instant-press/ Forum == http://www.pyforum.org/ Q&A (like Stack Overflow) == http://beta.qa-stack.com/ Conference Management = http://code.google.com/p/conf2py/ Web File Manager === http://code.google.com/p/elfinder-web2py/ Online Stores === http://code.google.com/p/web2py-estore/ Issue Tracking http://code.google.com/p/web2py-issuetracker/ https://bitbucket.org/alfonsodg/superticket/ Quiz/Survey application === https://bitbucket.org/rochacbruno/surveycloud Please no-comments, just add below if you know something good and useful ...