Re: [web2py] Re: Cannot register or login a user
I started a new app by copying the welcome folder instead of using the wizard. I copied over the models, views, and controllers from my old app. I also updated web2py to the latest. Using local account reg and login works perfectly. Enabling janrain bring up the login form, but after authenticating with my gmail account the page refreshes, but appears to not log me in. I just keep getting the sign in form. Anyone seen this before that cares to comment and point out the silly mistake I'm making? On Tue, May 31, 2011 at 1:40 AM, Jon Molesa rjmol...@gmail.com wrote: Nevermind. Thanks anyway. On Mon, May 30, 2011 at 10:23 PM, Jon Molesa rjmol...@gmail.com wrote: That line exists in default.py. On Mon, May 30, 2011 at 7:08 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: LOL. Make sure that you have def user(): return dict(form=auth()) If still does not work, show us your db.py On May 30, 5:41 pm, rjmolesa rjmol...@gmail.com wrote: I've goofed up my application in some way that prevents me from registering or logging in. How do I fix this please? -- Jon Molesa rjmol...@gmail.com -- Jon Molesa rjmol...@gmail.com -- Jon Molesa rjmol...@gmail.com
Re: Re : Re: [web2py] Re: Email invitation
On Tuesday, May 31, 2011 8:31:25 PM UTC-7, encompass wrote: Or interestID. It's still in alpha, but it does invites too. :D It's A conference management tool for the entire event life-cycle. It's a shameless plug cause it runs on Web2py. :D What's the URL?
[web2py] Re: matplotlib vs mod_wsgi... again
Ok, here it is the steps I followed... on a new web2py instance version 1.95.1 (2011-04-25 15:04:14) installed under mod_wsgi 3.3 and Apache/2.2.3 and python 2.6 I have downloaded and installed matplotlib-1.0.0 than under the welcome application I have installed plugin_matplotlib but visiting http://127.0.0.1:8000/welcome/plugin_matplotlib/index this is the traceback of the error I got Traceback (most recent call last): File /data/www/meteoproject_all/web2py/gluon/restricted.py, line 181, in restricted exec ccode in environment File /data/www/meteoproject_all/web2py/applications/welcome/models/plugin_matplotlib.py, line 5, in module from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas File /usr/lib64/python2.6/site-packages/matplotlib/backends/backend_agg.py, line 31, in module from matplotlib.figure import Figure File /usr/lib64/python2.6/site-packages/matplotlib/figure.py, line 18, in module from axes import Axes, SubplotBase, subplot_class_factory File /usr/lib64/python2.6/site-packages/matplotlib/axes.py, line 19, in module import matplotlib.collections as mcoll File /usr/lib64/python2.6/site-packages/matplotlib/collections.py, line 15, in module import matplotlib.cbook as cbook AttributeError: 'module' object has no attribute 'cbook' thank you cheers Manuele On 31/05/2011 15:55, Manuele Pesenti wrote: Hi *, old question still without answer... installing plugin_matplotlib inside the welcome app under a web2py installation that runs under apache using mod_wsgi I still got this: AttributeError: 'module' object has no attribute 'cbook' but the solution to load matplotlib and matplotlib.cbook before every other matplotlib import it's not a solution... what's the correct way to resolve it? PS: please don't suggest not to use mod_wsgi... isn't there a real solution? thank you very mutch Manuele
[web2py] Re: matplotlib vs mod_wsgi... again
On 01/06/2011 08:44, Manuele Pesenti wrote: Ok, here it is the steps I followed... I forgot to add that I have edited the model plugin_matplotlib in this way applying the solution suggested in this old post https://groups.google.com/forum/#!topic/modwsgi/97bnQk9ojtY import os, tempfile, random, cStringIO os.environ['MPLCONfigureDIR'] = tempfile.mkdtemp() ## import matplotlib import matplotlib.cbook ### from matplotlib.backends.backend_agg \ import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure from matplotlib.patches import Ellipse ...
[web2py] Re: crud onaccept vs form.accepts - is this expected
Why are you explicitly calling form.accepts -- crud.create and crud.update already call form.accepts themselves? On Tuesday, May 31, 2011 2:51:42 PM UTC-7, selecta wrote: def edit(): record_id = request.args(0) def on_accept(form): print 'in on accept' response.headers['web2py-component-command'] = XML(web2py_component('%s','list')%URL('list')) if not record_id: db.plugin_whishlist.open.readable, db.plugin_whishlist.open.writable = False, False form = crud.create(db.plugin_whishlist, onaccept = on_accept) else: form = crud.update(db.plugin_whishlist, record_id, onaccept = on_accept) if form.accepts(request.vars, session): print 'in this on accept ', form.vars.id response.headers['web2py-component-command'] = XML(web2py_component('%s','list')%URL('list')) return '' return form if the form is accepted it will print in this on accept that means it uses form.accepts instead of the function that is passed. is this behavior expected? it confused me a bit
[web2py] Re: validator for self-join
On Friday, May 6, 2011 8:56:12 AM UTC-7, pbreit wrote: I think this might be what you want: crud.settings.create_onvalidation.mytablename.append(lambda form:) http://web2py.com/book/default/chapter/07#Settings In the case of crud.update, it would be crud.settings.update_onvalidation. But crud.update(..., onvalidation=f) should work too.
[web2py] See a new GAE site that we developed with some web2py...
We developed a site on GAE with some of web2py... some of web2py means we didn't use everything but part of it. If anyone interested to have a look, visit www.LOCQL.com, it's a location based QA site build on GAE/Python. Don't need sign up, simply sign in with facebook you can have a try. Hope this is not a off topic emails... sorry for that. Just want to share with everyone, it's awesome to have python, web2py, django... and many more stuff to make develop website a enjoyful work!
[web2py] Re: See a new GAE site that we developed with some web2py...
Are you able to summarize how you used Web2py? Looks very nice!
Re: [web2py] See a new GAE site that we developed with some web2py...
On 06/01/2011 11:02 AM, maverick wrote: We developed a site on GAE with some of web2py... some of web2py means we didn't use everything but part of it. If anyone interested to have a look, visit www.LOCQL.com, it's a location based QA site build on GAE/Python. Don't need sign up, simply sign in with facebook you can have a try. Hope this is not a off topic emails... sorry for that. Just want to share with everyone, it's awesome to have python, web2py, django... and many more stuff to make develop website a enjoyful work! Nifty, and the topic is right on target. :) BR, Jason Brower
[web2py] I created a little app to be able to share some files over the net without authentication
With this little app you can share some files with everybody on net without authenticating - There is an authenticated user who can create upload sets. He or she can specify how many files can be uploaded and how long can somebody download or upload them. - He or she can specify a list of email address to notify is file get uploaded. - There is a link to the upload sets that can be used to upload files. - There is a link to the upload sets that can be used to download files. Link to the description: https://trac.oregpreshaz.eu/linux/wiki/ul#Description Link to download: https://trac.oregpreshaz.eu/linux/raw-attachment/wiki/ul/web2py.app.ul.w2p If somebody need it just download :)
Re: [web2py] Re: LOAD: ajax_trap errors...
yes, I like that keep the current release model and add some kind of Super Stable branch which is a X months old web2py without latest features but virtually bugs free On Wed, Jun 1, 2011 at 2:49 AM, pbreit pbreitenb...@gmail.com wrote: I'm pretty comfortable with the current pace. I think the next logical bit of progress would be to have two branches: 1) the current trunk and 2) the current 1.xx.x releases with critical bug fixes. -- Sebastian E. Ovide
Re: [web2py] I created a little app to be able to share some files over the net without authentication
Fun little app. Very easy to make and very useful. Even internal use may come in handy too. BR, Jason Brower On Wed, Jun 1, 2011 at 11:30 AM, szimszon szims...@gmail.com wrote: With this little app you can share some files with everybody on net without authenticating - There is an authenticated user who can create upload sets. He or she can specify how many files can be uploaded and how long can somebody download or upload them. - He or she can specify a list of email address to notify is file get uploaded. - There is a link to the upload sets that can be used to upload files. - There is a link to the upload sets that can be used to download files. Link to the description: https://trac.oregpreshaz.eu/linux/wiki/ul#Description Link to download: https://trac.oregpreshaz.eu/linux/raw-attachment/wiki/ul/web2py.app.ul.w2p If somebody need it just download :)
Re: [web2py] Re: unicode problem in DAL
So the value has to be Endcoded From Unicode into UTF8 before inserting? i am sure keys are str. We cannot store Unicode values ? On 5/31/11, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I am not sure there is a problem here. I cannot help without seeing an example of the data you insert. If you do: db.table.insert(**a) a must be a dictionary with str key and str (ut8 encoded) values. You cannot have unicode field names. Massimo On May 31, 2:40 am, Phyo Arkar phyo.arkarl...@gmail.com wrote: I have the exactly same problem here. Can anyone look into it? thanks alot. Stef have you found a solution? On Fri, Nov 5, 2010 at 5:47 PM, Stef Mientki stef.mien...@gmail.com wrote: I'm trying to insert a record with a filed value uëLocatie and I get an error in sql.Table._insert at the last line: return 'INSERT INTO %s(%s) VALUES (%s);' % (sql_t, sql_f, sql_v) here the traceback File D:\Data_Python_25\support\Web2Py_DAL_support.py, line 250, in DAL_Table Description = Value[3][:-1]) File P:\Web2PY\web2py_src\web2py\gluon\sql.py, line 2035, in insert query = self._insert(**fields) File P:\Web2PY\web2py_src\web2py\gluon\sql.py, line 2028, in _insert return 'INSERT INTO %s(%s) VALUES (%s);' % (sql_t, sql_f, sql_v) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 35: ordinal not in range(128) I don't understand the problem and know what I'm doing wrong Wwith print statements I tried to narrow the problem, and in : def sql_represent(obj, fieldtype, dbname, db_codec='UTF-8'): there's is this part if isinstance(obj, unicode): print '', type(obj),obj if len(obj)0 : print ord(obj[0]) obj = obj.encode(db_codec) print '', type(obj) if len(obj)0 : print ord(obj[0]) which seems to convert the unicode to a string with byte values larger than 128. Am I doing something wrong, or is this a bug ? And of course far more interesting, how do I solve this problem ? thanks, Stef Mientki
Re: [web2py] I created a little app to be able to share some files over the net without authentication
congratulation, nice application szimszon, had already put in the appliances?
Re: [web2py] I created a little app to be able to share some files over the net without authentication
May I ask you a hint about how to do it? :-o I shall try...
Re: [web2py] I created a little app to be able to share some files over the net without authentication
please go to http://web2py.com/appliances/default/edit/http://web2py.com/appliances/default/user/login?_next=/appliances/default/edit you will asked to login with janrain, after that, you can upload and share your application in there. great job, happy web2pying zimszon \(^o^)/
Re: [web2py] I created a little app to be able to share some files over the net without authentication
Thanks. Done. http://web2py.com/appliances/default/show/78
[web2py] built with web2py
http://www.filtons.com built with web2py running on cherokee
Re: [web2py] built with web2py
Very nice. On 6/1/11 6:54 AM, reedwan wrote: http://www.filtons.com built with web2py running on cherokee
[web2py] Re: running python on client side browser
i know Skulpt: http://www.skulpt.org/ could anyone explain differences? On 1 jun, 00:26, selecta gr...@delarue-berlin.de wrote: in case you do no know this yethttp://syntensity.com/static/python.html
[web2py] Re: unicode problem in DAL
You store unicode by passing it encoded. On Jun 1, 4:01 am, Phyo Arkar phyo.arkarl...@gmail.com wrote: So the value has to be Endcoded From Unicode into UTF8 before inserting? i am sure keys are str. We cannot store Unicode values ? On 5/31/11, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I am not sure there is a problem here. I cannot help without seeing an example of the data you insert. If you do: db.table.insert(**a) a must be a dictionary with str key and str (ut8 encoded) values. You cannot have unicode field names. Massimo On May 31, 2:40 am, Phyo Arkar phyo.arkarl...@gmail.com wrote: I have the exactly same problem here. Can anyone look into it? thanks alot. Stef have you found a solution? On Fri, Nov 5, 2010 at 5:47 PM, Stef Mientki stef.mien...@gmail.com wrote: I'm trying to insert a record with a filed value uëLocatie and I get an error in sql.Table._insert at the last line: return 'INSERT INTO %s(%s) VALUES (%s);' % (sql_t, sql_f, sql_v) here the traceback File D:\Data_Python_25\support\Web2Py_DAL_support.py, line 250, in DAL_Table Description = Value[3][:-1]) File P:\Web2PY\web2py_src\web2py\gluon\sql.py, line 2035, in insert query = self._insert(**fields) File P:\Web2PY\web2py_src\web2py\gluon\sql.py, line 2028, in _insert return 'INSERT INTO %s(%s) VALUES (%s);' % (sql_t, sql_f, sql_v) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 35: ordinal not in range(128) I don't understand the problem and know what I'm doing wrong Wwith print statements I tried to narrow the problem, and in : def sql_represent(obj, fieldtype, dbname, db_codec='UTF-8'): there's is this part if isinstance(obj, unicode): print '', type(obj),obj if len(obj)0 : print ord(obj[0]) obj = obj.encode(db_codec) print '', type(obj) if len(obj)0 : print ord(obj[0]) which seems to convert the unicode to a string with byte values larger than 128. Am I doing something wrong, or is this a bug ? And of course far more interesting, how do I solve this problem ? thanks, Stef Mientki
[web2py] problem with gae deployment
$ cd workspace/Running\ Project/ ramkrishan@ramkrishan-Aspire-5740:~/workspace/Running Project$ /home/ramkrishan/Downloads/Python-2.5.5/./python google_appengine/dev_appserver.py coporategift/web2py/ Traceback (most recent call last): File google_appengine/dev_appserver.py, line 76, in module run_file(__file__, globals()) File google_appengine/dev_appserver.py, line 72, in run_file execfile(script_path, globals_) File /home/ramkrishan/workspace/Running Project/google_appengine/google/appengine/tools/dev_appserver_main.py, line 146, in module from google.appengine.tools import appcfg File /home/ramkrishan/workspace/Running Project/google_appengine/google/appengine/tools/appcfg.py, line 69, in module from google.appengine.tools import appengine_rpc File /home/ramkrishan/workspace/Running Project/google_appengine/google/appengine/tools/appengine_rpc.py, line 27, in module import fancy_urllib File /home/ramkrishan/workspace/Running Project/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py, line 341, in module class FancyHTTPSHandler(urllib2.HTTPSHandler): AttributeError: 'module' object has no attribute 'HTTPSHandler' please tell me the solution ... i am using ubuntu 10.10
Re: [web2py] problem with gae deployment
2011/6/1 ramkrishan bhatt ramkrishan.bh...@gmail.com: $ cd workspace/Running\ Project/ ramkrishan@ramkrishan-Aspire-5740:~/workspace/Running Project$ /home/ramkrishan/Downloads/Python-2.5.5/./python google_appengine/dev_appserver.py coporategift/web2py/ Traceback (most recent call last): File google_appengine/dev_appserver.py, line 76, in module run_file(__file__, globals()) File google_appengine/dev_appserver.py, line 72, in run_file execfile(script_path, globals_) File /home/ramkrishan/workspace/Running Project/google_appengine/google/appengine/tools/dev_appserver_main.py, line 146, in module from google.appengine.tools import appcfg File /home/ramkrishan/workspace/Running Project/google_appengine/google/appengine/tools/appcfg.py, line 69, in module from google.appengine.tools import appengine_rpc File /home/ramkrishan/workspace/Running Project/google_appengine/google/appengine/tools/appengine_rpc.py, line 27, in module import fancy_urllib File /home/ramkrishan/workspace/Running Project/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py, line 341, in module class FancyHTTPSHandler(urllib2.HTTPSHandler): AttributeError: 'module' object has no attribute 'HTTPSHandler' please tell me the solution ... i am using ubuntu 10.10 Have you tried Googling a little bit? Copying and paste your error message Google will give you the reason of your error (wrong python version) and solution (install python2.5) in the first result. Regards
Re : Re: Re : Re: [web2py] Re: Email invitation
Yes pbreit. This is what I am trying to do. I emphasize the fact that only they can register to the entire website. I am not sure that Eventbrite can help me. I also would like to program it myself. Dwayne
[web2py] Re: error on crud.update delete
You'll need to show your code as well. On 31 Май, 23:46, selecta gr...@delarue-berlin.de wrote: ERROR:web2py:Traceback (most recent call last): File /home/select/Dev/web2py/gluon/restricted.py, line 181, in restricted exec ccode in environment File /home/select/Dev/web2py/applications/pyMantis/controllers/ plugin_whishlist.py, line 118, in module File /home/select/Dev/web2py/gluon/globals.py, line 133, in lambda self._caller = lambda f: f() File /home/select/Dev/web2py/gluon/tools.py, line 2335, in f return action(*a, **b) File /home/select/Dev/web2py/applications/pyMantis/controllers/ plugin_whishlist.py, line 68, in edit if form.accepts(request.vars, session): File /home/select/Dev/web2py/gluon/sqlhtml.py, line 1200, in accepts self.table._db(self.table.id == self.record.id).update(**fields) File /home/select/Dev/web2py/gluon/dal.py, line 5173, in update fields = self.db[tablename]._listify(update_fields,update=True) File /home/select/Dev/web2py/gluon/dal.py, line 4464, in _listify raise SyntaxError, 'Field %s does not belong to the table' % name SyntaxError: Field delete_this_record does not belong to the table is this somehow my fault? not sure how to debug
[web2py] change colnames export_to_csv_file
Is there any way to change colnames before exporting to CSV? Now I have a query like this: students=db().select(db.students.email, db.students.name) And I'm getting the excel with columns like: students.email | students.name Would be nice to change that to Email and Name, but can't find any solution
[web2py] Re: built with web2py
Wow! Very nice looking! Congrats
Re: [web2py] Re: dashboard...
How long you figure the task could take... It is a plugin right? I try to install it and I got cronfolder missing or something like this... I will unpack it to look at the code... Richard On Tue, May 31, 2011 at 6:38 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: very old code, should be rewritten using LOAD(...). On May 31, 5:25 pm, Bruno Rocha rochacbr...@gmail.com wrote: Are you aware of it? -http://web2py.com/jpolite/http://web2py.com/jpolite/default/main#t1 -- Bruno Rocha [ About me:http://zerp.ly/rochacbruno] [ Aprenda a programar:http://CursoDePython.com.br] [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br] [ Consultoria em desenvolvimento web:http://www.blouweb.com] On Tue, May 31, 2011 at 6:50 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Hello All, Here a 5 min search and a bunch of links refering differents dashboard implementation or code : http://plugins.jquery.com/plugin-tags/dashboard http://civicactions.com/blog/2009/feb/22/jquerydashboard_plugin http://jqueryui.com/demos/sortable/#portlets http://stackoverflow.com/questions/1648008/igoogle-style-dashboard-us... http://net.tutsplus.com/tutorials/javascript-ajax/inettuts/ http://civicrm.org/node/677 http://nettuts.s3.amazonaws.com/127_iNETTUTS/demo/index.html http://www.dynamicdashboards.net/ http://sweettam.blogspot.com/2011/02/creating-webpage-like-igoogle-us... http://www.webappers.com/2008/11/19/how-to-create-igoogle-interface-w... If you would like to share experiences with w2p of any dashboard implementation of your own... I will have to make friendlier dashboard in the near future... So I am interresting in web2py user experience about that topic... Thanks. Richard
[web2py] Re: super in templates
OK! Thank you for explanation. I just have to live with that and modify my apps to do those things differently. Teemu
[web2py] Conditional insert/update/delete to many tables from one form
I have written code for managing conditional insert/update/delete to multiple tables from single form. (I had posted my code-attempt in earlier thread, but seems it was lost in the heap of other threads. Hence posting it again here. I agree, the code is in very raw form may not be ‘pythonic’. There are code repeatitions. But at least I have something to go ahead build a refined structure. I present my code as under. (Comments are given to explain the flow) I would highly welcome any ideas/suggestions for improvements. ## Code starts here ## MODELS: db.define_table('mdlmst', Field('mdlmstid','id'), Field('mdlmstcd'), Field('mdlmstnm'), migrate=False, format='%(mdlmstnm)s' ) db.define_table('wrmst', Field('wrmstid','id'), Field('wrmstcd'), Field('wrmstnm'), migrate=False, format='%(wrmstnm)s' ) db.define_table('extwrmst', Field('extwrmstid','id'), Field('extwrmstcd'), Field('extwrmstnm'), migrate=False, format='%(extwrmstnm)s' ) # from the FORM, data will be populated in the following two tables db.define_table('mdlwr', Field('mdlwrid','id'), Field('mdlmstid',db.mdlmst), Field('wrmstid',db.wrmst), migrate=False ) db.define_table('mdlextwr', Field('mdlextwrid','id'), Field('mdlmstid',db.mdlmst), Field('extwrmstid',db.extwrmst), migrate=False ) CONTROLLERS: ### ‘modelwar’ controller will render the records from ‘mdlmst’ table def modelwar(): models = db(db.mdlmst.mdlmstid0).select(orderby=db.mdlmst.mdlmstnm) return dict(models=models) ### after clicking a particular record, ‘war_edit’ controller will manage the tables – ‘mdlwr’ ‘mdlextwr’ def war_edit(): mdl_id = request.args(0)# variable identifying the ‘mdlmstid’ (which record to be modified) mdl_nm = request.args(1)# variable for getting ‘mdlmstnm’ warset = db(db.mdlwr.mdlmstid==mdl_id) # fetch a set extwarset = db(db.mdlextwr.mdlmstid==mdl_id) warlist = db(db.mdlwr.mdlmstid==mdl_id).select()# get a ROW object extwarlist = db(db.mdlextwr.mdlmstid==mdl_id).select() form_war=FORM(TABLE(TR(Basic Warranty, SELECT(_type=select,_name=baswar,*[OPTION(x.wrmstnm,_value=x.wrmstid) for x in db().select(db.wrmst.ALL)]), TR(Extended Warranty, SELECT(_type=select,_name=extwar,*[OPTION(x.extwrmstnm,_value=x.extwrms tid)for x in db().select(db.extwrmst.ALL)]), TR(, INPUT(_type='submit',_value='Save')), # pre-populate the fields in‘form_war’ if len(warlist)0: form_war.vars.baswar = warlist[0].wrmstid if len(extwarlist)0: form_war.vars.extwar = extwarlist[0].extwrmstid # after successful form submission, manage the table 'mdlwr' if form_war.accepts(request.vars, session): if len(warlist)0: # if there was any record in the list fetched from database sent to FORM, if form_war.vars.baswar=='':# delete if value returned from FORM field is blank warset.delete() else: warset.update(wrmstid=form_war.vars.baswar) # else update, else: db.mdlwr.insert(mdlmstid=mdl_id, wrmstid=form_war.vars.baswar) # else insert # Similarly, manage the table 'mdlextwr' if len(extwarlist)0: if form_war.vars.extwar=='': extwarset.delete() else: extwarset.update(extwrmstid=form_war.vars.extwar) else: db.mdlextwr.insert(mdlmstid=mdl_id, extwrmstid=form_war.vars.extwar) response.flash = 'Warranty definition saved' return dict(form_war=form_war,mdlnm=mdl_nm) VIEW for 'mdlmst' table {{response.files.append(URL(r=request,c='static',f='jquery.dataTables.min.j s'))}} {{response.files.append(URL(r=request,c='static',f='demo_table.css'))}} {{extend 'layout.html'}} scriptjQuery(document).ready(function() { jQuery('.smarttable').dataTable();});/script h1Modelwise Warranty Master/h1 table class=smarttable thead trthModel ID/ththModel Code/ththModel Name/ th /tr/thead tbody{{for model in models:}} tr td{{=model.mdlmstid}}/td td{{=model.mdlmstcd}}/td td{{=model.mdlmstnm}}/td td{{=A('edit warranty',_href=URL('war_edit',args=[model.mdlmstid,model.mdlmstnm]))}} /tr {{pass}} /tbody /table Code ends here A generic class is needed to be written for managing actions (insert/ update/delete) based on the results fetched from database return values from FORM. Hopefully, the same might be useful to many other web2py programmers also. I look forward to your ideas for enhancement. Thanks, Vineet
Re: [web2py] Re: web2py rpc
I am actually using web2py as a JSON-RPC service now. Using RPC, you can make a web2py application act like you are running functions on the local machine. This is most commonly used to provide a desktop application that can interface with your web service. Right now, I have a web2py installation running on a server that has a serial port connection to a piece of hardware and my application talks to the device on the other end of the serial cable. I didn't want to write a web interface for it on that same machine, as I wanted to integrate the functionality with a larger web2py application running on a web server. So the main web server runs my web2py application as normal, and when a user needs information from the serial-connected device on the other server, my application makes a JSON-RPC call to the machine that communicates with the device, and it returns the result.
[web2py] Possible bug in trunk dal.py
Hi, I'm reporting a possible bug with trunk version of dal.py. I'm having the traceback: Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /home/www-data/web2py/applications/backend/controllers/ appadmin.py, line 411, in module File /home/www-data/web2py/gluon/globals.py, line 135, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/backend/controllers/ appadmin.py, line 127, in insert if form.accepts(request.vars, session): File /home/www-data/web2py/gluon/sqlhtml.py, line 1205, in accepts self.vars.id = self.table.insert(**fields) File /home/www-data/web2py/gluon/dal.py, line 4634, in insert return self._db._adapter.insert(self,self._listify(fields)) File /home/www-data/web2py/gluon/dal.py, line 814, in insert raise e IntegrityError: (1452, u'Cannot add or update a child row: a foreign key constraint fails (`tuubiodb`.`tags`, CONSTRAINT `tags_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `tags` (`id`) ON DELETE CASCADE)') with table definition db.define_table(tags, Field(name,string), Field(parent, reference tags,required=False), format=%(name)s) Web2py tries to insert parent with value 0, while mySQL only accepts null as a reference to non-existing table.
[web2py] SQLFORM.factory example from book does not work
When playing around with uploads, I tried to get the example from the web2py book working: def form_from_factory(): form = SQLFORM.factory( Field('your_name', requires=IS_NOT_EMPTY()), Field('your_image', 'upload')) if form.accepts(request.vars, session): response.flash = 'form accepted' session.your_name = form.vars.your_name session.filename = form.vars.your_image elif form.errors: response.flash = 'form has errors' return dict(form=form) When run, it gave me this error (on a brand new version 1.95.1) Traceback (most recent call last): File /home/jon/code/sandpit/web2py/gluon/restricted.py, line 181, in restricted exec ccode in environment File /home/jon/code/sandpit/web2py/applications/upload/controllers/ upload.py, line 14, in module File /home/jon/code/sandpit/web2py/gluon/globals.py, line 133, in lambda self._caller = lambda f: f() File /home/jon/code/sandpit/web2py/applications/upload/controllers/ upload.py, line 6, in form_from_factory if form.accepts(request.vars, session): File /home/jon/code/sandpit/web2py/gluon/sqlhtml.py, line 1146, in accepts newfilename = field.store(source_file, original_filename) File /home/jon/code/sandpit/web2py/gluon/dal.py, line 4966, in store raise RuntimeError, you must specify a Field(...,uploadfolder=...) RuntimeError: you must specify a Field(...,uploadfolder=...) To fix it I had to - import os - change the upload field to Field('your_image', 'upload', uploadfolder=os.path.join(request.folder,'uploads')) I thought uploadfield should default to what I have added, from the description of Field in the book. Have I done something stupid?
Re: [web2py] Re: web2py rpc
a, i understand right now, it seems so widely implementation for rpc, thank you so much for sharing
Re: [web2py] Re: web2py rpc
How do you handle remote authentication using json-rpc? I would like to try it; Thanks. On 6/1/11 10:48 AM, Stifan Kristi wrote: a, i understand right now, it seems so widely implementation for rpc, thank you so much for sharing
[web2py] upload file without storing it
I wish to upload a file, then process it without storing it in the upload folder (or anywhere else on the file system). I am trying to use the 'SQLFORM.Factory' because it gives me the nice html table of input fields, and the normal 'if form.accepts' processing for convenience. I thought I could persuade the form to upload and store the file contents in 'request.vars.field.file' for processing. Nothing I have tried so far in the field definition has allowed me to access the contents of the file in a variable, without it being stored to disk. Can anybody advise me what is the simplest way to achieve this? Thanks.
Re: [web2py] upload file without storing it
request.vars.field_in_form.file should give you the binary definition of the file, I am using it with uploadify -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ] On Wed, Jun 1, 2011 at 11:43 AM, jc j-cl...@lineone.net wrote: I wish to upload a file, then process it without storing it in the upload folder (or anywhere else on the file system). I am trying to use the 'SQLFORM.Factory' because it gives me the nice html table of input fields, and the normal 'if form.accepts' processing for convenience. I thought I could persuade the form to upload and store the file contents in 'request.vars.field.file' for processing. Nothing I have tried so far in the field definition has allowed me to access the contents of the file in a variable, without it being stored to disk. Can anybody advise me what is the simplest way to achieve this? Thanks.
[web2py] Re: problem with gae deployment
check to see whether the command you indicated: $ /home/ramkrishan/Downloads/Python-2.5.5/./python is running 2.6 or 2.5.5 not sure what the effect of the /./ would be on your installation; the error is indicative of Python 2.6, which may be what is getting run; with Ubuntu 10.x, you may wish to get the 'Dead Snakes' branch of Python 2.5.5 from Launchpad; once installed, you can run it from anywhere with 'python2.5' On Jun 1, 7:14 am, ramkrishan bhatt ramkrishan.bh...@gmail.com wrote: $ cd workspace/Running\ Project/ ramkrishan@ramkrishan-Aspire-5740:~/workspace/Running Project$ /home/ramkrishan/Downloads/Python-2.5.5/./python google_appengine/dev_appserver.py coporategift/web2py/ Traceback (most recent call last): File google_appengine/dev_appserver.py, line 76, in module run_file(__file__, globals()) File google_appengine/dev_appserver.py, line 72, in run_file execfile(script_path, globals_) File /home/ramkrishan/workspace/Running Project/google_appengine/google/appengine/tools/dev_appserver_main.py, line 146, in module from google.appengine.tools import appcfg File /home/ramkrishan/workspace/Running Project/google_appengine/google/appengine/tools/appcfg.py, line 69, in module from google.appengine.tools import appengine_rpc File /home/ramkrishan/workspace/Running Project/google_appengine/google/appengine/tools/appengine_rpc.py, line 27, in module import fancy_urllib File /home/ramkrishan/workspace/Running Project/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py, line 341, in module class FancyHTTPSHandler(urllib2.HTTPSHandler): AttributeError: 'module' object has no attribute 'HTTPSHandler' please tell me the solution ... i am using ubuntu 10.10
Re: [web2py] built with web2py
Hi, Very nice website, congrats. I have some questions, if could explain.. I see your images are loading very fast, how are you serving images? (cdn, download(), ../static) what the server config you are using? I has some problems to load images directly served by web2py static, so I am trying to figure out how people are using it (or if it is a problem on my server) Thanks.. -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ] On Wed, Jun 1, 2011 at 7:54 AM, reedwan reed...@gmail.com wrote: http://www.filtons.com built with web2py running on cherokee
Re: [web2py] built with web2py
Bruno. I take all my static files out of web2py. It seems much better. Basically just static serve from web server. On Jun 1, 2011 11:13 AM, Bruno Rocha rochacbr...@gmail.com wrote: Hi, Very nice website, congrats. I have some questions, if could explain.. I see your images are loading very fast, how are you serving images? (cdn, download(), ../static) what the server config you are using? I has some problems to load images directly served by web2py static, so I am trying to figure out how people are using it (or if it is a problem on my server) Thanks.. -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ] On Wed, Jun 1, 2011 at 7:54 AM, reedwan reed...@gmail.com wrote: http://www.filtons.com built with web2py running on cherokee
[web2py] Multiprocessing Issue with Web2py
I'm trying to start a background process to monitor the audio and am using pyaudio to accomplish it. I started with a separate script, but decided it seemed simpler to move the code into my module. The issue is that once I call the p.open to create the stream the subprocess hangs and I never get the pid back. If I remove the stream = line then it works fine. I started out thinking this was a python issue, but when I test outside of web2py (snip out the appropriate functions and run via cli) it works fine. from subprocess import * from multiprocessing import Process, Queue def listener(self, q): CHANNELS = 2 RATE = 44100 INPUT_BLOCK_TIME = 0.05 FORMAT = pyaudio.paInt16 RATE = 44100 INPUT_FRAMES_PER_BLOCK = int(RATE*INPUT_BLOCK_TIME) p = pyaudio.PyAudio() stream = p.open(format = FORMAT, channels = CHANNELS, rate = RATE, input = True, frames_per_buffer = INPUT_FRAMES_PER_BLOCK) q.put(os.getpid()) import time time.sleep(300) def startListener(self): q = Queue() p = Process(target=self.listener, args=[q]) p.daemon=True p.start() print q.get() Is there something about threading or modules that prevents this from working in web2py? Any help is appreciated!
Re: [web2py] built with web2py
I don't use the download() function anymore and serve static files straight from Nginx and it works very well. I am also looking at a very cool new service, CloudFlare that is free! What you do is switch your DNS entires to CloudFlare-provided DNS servers and then CloudFlare caches all your images as well as provides threat-protection and other good stuff. It's basically a free way to speed up your web site and only takes about 5 minutes to set up. The one caveat is that you have to pay for SSL.
Re: [web2py] Re: web2py rpc
pardon me, i still learning and tried what was written on the book, but got confused about what is use for my application, so that i asked to the web2py forum community. On Wed, Jun 1, 2011 at 9:50 PM, David J. da...@styleflare.com wrote: How do you handle remote authentication using json-rpc? I would like to try it; Thanks. On 6/1/11 10:48 AM, Stifan Kristi wrote: a, i understand right now, it seems so widely implementation for rpc, thank you so much for sharing
[web2py] Re: Consuming a web2py web service in C#?
This is what I have concluded... The problem is that many Windows based JSON-RPC serializers (Including jayrock) and proxy's append a 3 byte UTF-8 BOM (Byte Order Mark) to the beginning of the resulting encoded JSON text that is sent in the body of the HTML request. Note that this is not a feature added by jayrock or any other JSON-RPC library, it is a Windows OS specific encoding practice for UTF-8 strings. Python does not bother with this because UTF-8 is it's natural language encoding and assumes this without being told by use of the BOM. So, what should be sent as '{params:hello,id: 1,method:echo}' for example is sent as '\xef\xbb \xbf{params:hello,id:1,method:echo}' by jayrock. Neither simplejson or web2py's serve_jsonrpc function (in tools.py) check for this UTF-8 BOM when decoding the JSON string. I am not 100% sure where this problem should be fixed in the code, in simplejson's decode function or web2py's serve_jsonrpc function, but I made these changes to the code in web2py's serve_jsonrpc function: From: -- request = self.environment['request'] methods = self.jsonrpc_procedures data = simplejson.loads(request.body.read()) id, method, params = data['id'], data['method'], data.get('params','') To: (added: import codecsto the top of the file) -- request = self.environment['request'] methods = self.jsonrpc_procedures # added theBody = request.body.read() if theBody.startswith( codecs.BOM_UTF8 ): theBody = theBody[3:] #data = simplejson.loads(request.body.read()) data = simplejson.loads(theBody) id, method, params = data['id'], data['method'], data.get('params','') This strips out the 3 byte UTF-8 BOM at the beginning of the body of the HTML and calls from jayrock's JSON-RPC client's work just fine. This is something that needs to be fixed and included in web2py's source. Or perhaps the fix belongs in the simplejson library? On May 20, 4:23 pm, Matt ima...@gmail.com wrote: Anyone using web2py as the web service and then consuming the service via json-rpc in C#? I imagine this is possible, but seem to have quite some time trying to get this to work. I'm usingjayrockas my json-rpc C# parser and setting the url to the service to be my exposed web2py service but can't seem to get the data. I'd be interested to know if anyone is doing something similar. Thanks. -m
[web2py] Re: error on crud.update delete
BTW... are you running stable. Can you try trunk. I remeber fixing something related to this. On May 31, 3:46 pm, selecta gr...@delarue-berlin.de wrote: ERROR:web2py:Traceback (most recent call last): File /home/select/Dev/web2py/gluon/restricted.py, line 181, in restricted exec ccode in environment File /home/select/Dev/web2py/applications/pyMantis/controllers/ plugin_whishlist.py, line 118, in module File /home/select/Dev/web2py/gluon/globals.py, line 133, in lambda self._caller = lambda f: f() File /home/select/Dev/web2py/gluon/tools.py, line 2335, in f return action(*a, **b) File /home/select/Dev/web2py/applications/pyMantis/controllers/ plugin_whishlist.py, line 68, in edit if form.accepts(request.vars, session): File /home/select/Dev/web2py/gluon/sqlhtml.py, line 1200, in accepts self.table._db(self.table.id == self.record.id).update(**fields) File /home/select/Dev/web2py/gluon/dal.py, line 5173, in update fields = self.db[tablename]._listify(update_fields,update=True) File /home/select/Dev/web2py/gluon/dal.py, line 4464, in _listify raise SyntaxError, 'Field %s does not belong to the table' % name SyntaxError: Field delete_this_record does not belong to the table is this somehow my fault? not sure how to debug
[web2py] Re: change colnames export_to_csv_file
yes rows.export_to_csv_file(open(),colnames=[]) On Jun 1, 8:38 am, Bob handzh...@gmail.com wrote: Is there any way to change colnames before exporting to CSV? Now I have a query like this: students=db().select(db.students.email, db.students.name) And I'm getting the excel with columns like: students.email | students.name Would be nice to change that to Email and Name, but can't find any solution
[web2py] Re: Possible bug in trunk dal.py
Did you try: db.define_table(tags, Field(name,string), Field(parent, reference tags,default=None), format=%(name)s) On Jun 1, 9:30 am, Oskari oskari.pe...@gmail.com wrote: Hi, I'm reporting a possible bug with trunk version of dal.py. I'm having the traceback: Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /home/www-data/web2py/applications/backend/controllers/ appadmin.py, line 411, in module File /home/www-data/web2py/gluon/globals.py, line 135, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/backend/controllers/ appadmin.py, line 127, in insert if form.accepts(request.vars, session): File /home/www-data/web2py/gluon/sqlhtml.py, line 1205, in accepts self.vars.id = self.table.insert(**fields) File /home/www-data/web2py/gluon/dal.py, line 4634, in insert return self._db._adapter.insert(self,self._listify(fields)) File /home/www-data/web2py/gluon/dal.py, line 814, in insert raise e IntegrityError: (1452, u'Cannot add or update a child row: a foreign key constraint fails (`tuubiodb`.`tags`, CONSTRAINT `tags_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `tags` (`id`) ON DELETE CASCADE)') with table definition db.define_table(tags, Field(name,string), Field(parent, reference tags,required=False), format=%(name)s) Web2py tries to insert parent with value 0, while mySQL only accepts null as a reference to non-existing table.
[web2py] jquery effect
hi, i've read and try to implement form select jquery on the book http://web2py.com/book/default/chapter/10#Conditional-Fields-in-Forms, but have no effect. e.g. script jQuery(document).ready(function(){ jQuery('#blog_visibility').change(function(){ if(jQuery('#blog_visibility').attr('Protected')) jQuery('#blog_password__row').show(); else jQuery('#blog_password__row').hide();}); }); /script and script jQuery(document).ready(function(){ if(jQuery('#blog_visibility').attr('onchange','Protected')) jQuery('#blog_password__row').show(); else jQuery('#blog_password__row').hide(); }); /script i know i have wrong code, did anyone knows how to fixed it? thank you so much in advance
[web2py] Re: built with web2py
Are you doing anything special in regards to how images are uploaded, cropped and saved?
[web2py] Re: SQLFORM.factory example from book does not work
No it is just that SQLFORM.factory is not associated to a db object and does not know what to do. You have to explicit. What you did is correct. On Jun 1, 9:34 am, jc j-cl...@lineone.net wrote: When playing around with uploads, I tried to get the example from the web2py book working: def form_from_factory(): form = SQLFORM.factory( Field('your_name', requires=IS_NOT_EMPTY()), Field('your_image', 'upload')) if form.accepts(request.vars, session): response.flash = 'form accepted' session.your_name = form.vars.your_name session.filename = form.vars.your_image elif form.errors: response.flash = 'form has errors' return dict(form=form) When run, it gave me this error (on a brand new version 1.95.1) Traceback (most recent call last): File /home/jon/code/sandpit/web2py/gluon/restricted.py, line 181, in restricted exec ccode in environment File /home/jon/code/sandpit/web2py/applications/upload/controllers/ upload.py, line 14, in module File /home/jon/code/sandpit/web2py/gluon/globals.py, line 133, in lambda self._caller = lambda f: f() File /home/jon/code/sandpit/web2py/applications/upload/controllers/ upload.py, line 6, in form_from_factory if form.accepts(request.vars, session): File /home/jon/code/sandpit/web2py/gluon/sqlhtml.py, line 1146, in accepts newfilename = field.store(source_file, original_filename) File /home/jon/code/sandpit/web2py/gluon/dal.py, line 4966, in store raise RuntimeError, you must specify a Field(...,uploadfolder=...) RuntimeError: you must specify a Field(...,uploadfolder=...) To fix it I had to - import os - change the upload field to Field('your_image', 'upload', uploadfolder=os.path.join(request.folder,'uploads')) I thought uploadfield should default to what I have added, from the description of Field in the book. Have I done something stupid?
[web2py] Re: Multiprocessing Issue with Web2py
Yes. The web server will kill requests that take tool long. You must run something like this in a background process. On Jun 1, 10:26 am, Nite nitese...@gmail.com wrote: I'm trying to start a background process to monitor the audio and am using pyaudio to accomplish it. I started with a separate script, but decided it seemed simpler to move the code into my module. The issue is that once I call the p.open to create the stream the subprocess hangs and I never get the pid back. If I remove the stream = line then it works fine. I started out thinking this was a python issue, but when I test outside of web2py (snip out the appropriate functions and run via cli) it works fine. from subprocess import * from multiprocessing import Process, Queue def listener(self, q): CHANNELS = 2 RATE = 44100 INPUT_BLOCK_TIME = 0.05 FORMAT = pyaudio.paInt16 RATE = 44100 INPUT_FRAMES_PER_BLOCK = int(RATE*INPUT_BLOCK_TIME) p = pyaudio.PyAudio() stream = p.open(format = FORMAT, channels = CHANNELS, rate = RATE, input = True, frames_per_buffer = INPUT_FRAMES_PER_BLOCK) q.put(os.getpid()) import time time.sleep(300) def startListener(self): q = Queue() p = Process(target=self.listener, args=[q]) p.daemon=True p.start() print q.get() Is there something about threading or modules that prevents this from working in web2py? Any help is appreciated!
[web2py] Re: dashboard...
There's also a newer version of JPolite: http://www.trilancer.com/jpolite2/ On Tuesday, May 31, 2011 3:38:26 PM UTC-7, Massimo Di Pierro wrote: very old code, should be rewritten using LOAD(...). On May 31, 5:25 pm, Bruno Rocha rocha...@gmail.com wrote: Are you aware of it? -http://web2py.com/jpolite/ http://web2py.com/jpolite/default/main#t1 -- Bruno Rocha [ About me:http://zerp.ly/rochacbruno] [ Aprenda a programar:http://CursoDePython.com.br] [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br] [ Consultoria em desenvolvimento web:http://www.blouweb.com] On Tue, May 31, 2011 at 6:50 PM, Richard Vézina ml.richa...@gmail.com wrote: Hello All, Here a 5 min search and a bunch of links refering differents dashboard implementation or code : http://plugins.jquery.com/plugin-tags/dashboard http://civicactions.com/blog/2009/feb/22/jquerydashboard_plugin http://jqueryui.com/demos/sortable/#portlets http://stackoverflow.com/questions/1648008/igoogle-style-dashboard-us... http://net.tutsplus.com/tutorials/javascript-ajax/inettuts/ http://civicrm.org/node/677 http://nettuts.s3.amazonaws.com/127_iNETTUTS/demo/index.html http://www.dynamicdashboards.net/ http://sweettam.blogspot.com/2011/02/creating-webpage-like-igoogle-us... http://www.webappers.com/2008/11/19/how-to-create-igoogle-interface-w... If you would like to share experiences with w2p of any dashboard implementation of your own... I will have to make friendlier dashboard in the near future... So I am interresting in web2py user experience about that topic... Thanks. Richard
Re: [web2py] Re: web2py rpc
On Wednesday, June 1, 2011 7:50:30 AM UTC-7, David J wrote: How do you handle remote authentication using json-rpc? I haven't tried it, but here's what the book has to say: http://web2py.com/book/default/chapter/09#Services-and-Authentication
[web2py] Re: built with web2py
Looks excellent! I like the clean and simple but not typical design.
Re: Re : Re: Re : Re: [web2py] Re: Email invitation
You could do an onvalidation that checks that the email address provided and/or uuid is acceptable: http://web2py.com/book/default/chapter/07#onvalidation
Re: [web2py] Re: web2py rpc
I guess there's a school of thought that web apps will be mostly or entirely JavaScript in the browser pushing and pulling data, probably in JSON format, to/from the server.
Re: [web2py] Re: web2py rpc
All the communication is done on the local network, so security isn't a huge issue, however, I still require the JSON-RPC service to communicate over HTTPS so that when I pass username/password combinations to it, it's all encrypted. And I use a custom controller that checks authentication. Although, now that Massimo has enabled web2py to be used as a CAS provider by default, this may be the best way to go.
[web2py] Re: jquery effect
I'm not exactly sure what's going here, but at first glance, this is what I see: I think you are using attr() wrong. In the first section of code, you are checking the 'Protected' attribute, but in the second block of code, you are setting an 'onchange' attribute to the value of 'Protected', Maybe this should read attr('Protected', true) instead?
[web2py] GAE taskqueue with Web2py 1.95.1
do I use: from google.appengine.api.labs import taskqueue or from google.appengine.api import taskqueue ie with or without .labs dev_appserver.py tries to call my task url (correctly logging the url) but claims it returns with a 500 do I see to add an entry to routes.py or index.yaml? I can't find any references to such a thing.
[web2py] Re: Multiprocessing Issue with Web2py
I'm not sure that applies here... or not sure *how* it applies. 1. My tests have all been with the commandline so there is no webserver involved. 2. The same methodology works fine elsewhere to spawn secondary processes (have been using it for a month or so and it works well). 3. I can test and verify that using the multiprocessing module to spawn a long running (10+ min) background process works fine within web2py. I get the PID back, store and use it later to kill the process. 4. Another thread on this list discussed the multiprocessing library: http://groups.google.com/group/web2py/browse_thread/thread/98e4e0ec731a97a1/cd2520facc0ee6ea?lnk=gstq=nitesedge#cd2520facc0ee6ea As far as I can understand (what am I missing?) the only distinction is opening the pyaudio stream. Perhaps there is an incompatibility between pyaudio and web2py? -- Nite On Jun 1, 12:19 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Yes. The web server will kill requests that take tool long. You must run something like this in a background process. On Jun 1, 10:26 am, Nite nitese...@gmail.com wrote: I'm trying to start a background process to monitor the audio and am using pyaudio to accomplish it. I started with a separate script, but decided it seemed simpler to move the code into my module. The issue is that once I call the p.open to create the stream the subprocess hangs and I never get the pid back. If I remove the stream = line then it works fine. I started out thinking this was a python issue, but when I test outside of web2py (snip out the appropriate functions and run via cli) it works fine. from subprocess import * from multiprocessing import Process, Queue def listener(self, q): CHANNELS = 2 RATE = 44100 INPUT_BLOCK_TIME = 0.05 FORMAT = pyaudio.paInt16 RATE = 44100 INPUT_FRAMES_PER_BLOCK = int(RATE*INPUT_BLOCK_TIME) p = pyaudio.PyAudio() stream = p.open(format = FORMAT, channels = CHANNELS, rate = RATE, input = True, frames_per_buffer = INPUT_FRAMES_PER_BLOCK) q.put(os.getpid()) import time time.sleep(300) def startListener(self): q = Queue() p = Process(target=self.listener, args=[q]) p.daemon=True p.start() print q.get() Is there something about threading or modules that prevents this from working in web2py? Any help is appreciated!
[web2py] Problems using LOAD function
Hello, The following code before I updated web2py via mercurial worked well for me. Now I get the following error if the ajax parameter is set to False. If is set to True, there is no error but the place where the view should be loaded is alway saying: loading... and nothing is showed. div class=unit div class=container div id=nav {{=LOAD('default','menu',ajax=False)}} /div /div /div Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /var/web2py/applications/init/views/default/ver_datos.html, line 61, in module td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td File /var/web2py/gluon/compileapp.py, line 135, in __call__ page = run_controller_in(c, f, other_environment) File /var/web2py/gluon/compileapp.py, line 429, in run_controller_in restricted(code, environment, filename) File /var/web2py/gluon/restricted.py, line 192, in restricted raise RestrictedError(layer, code, '', environment) RestrictedError Any help, please?? Thanks in advance
[web2py] Re: Problems using LOAD function
Please try LOAD('default','menu',ajax=True) you may get a ticket. Check what it says. On Jun 1, 12:34 pm, salbefe salb...@gmail.com wrote: Hello, The following code before I updated web2py via mercurial worked well for me. Now I get the following error if the ajax parameter is set to False. If is set to True, there is no error but the place where the view should be loaded is alway saying: loading... and nothing is showed. div class=unit div class=container div id=nav {{=LOAD('default','menu',ajax=False)}} /div /div /div Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /var/web2py/applications/init/views/default/ver_datos.html, line 61, in module td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td File /var/web2py/gluon/compileapp.py, line 135, in __call__ page = run_controller_in(c, f, other_environment) File /var/web2py/gluon/compileapp.py, line 429, in run_controller_in restricted(code, environment, filename) File /var/web2py/gluon/restricted.py, line 192, in restricted raise RestrictedError(layer, code, '', environment) RestrictedError Any help, please?? Thanks in advance
[web2py] web2py 1.96.1 is OUT
I could not wait any longer. We had so many changes that we need to move on. I do not recall any other release with so many new features. Thanks to all those who have contributed with patches and testing. Changelog: - from gluon import * imports in every python module a web2py environment (A, DIV,..SQLFORM, DAL, Field,...) including current.request, current.response, current.session, current.T, current.cache, thanks Jonathan. - conditional models in models/controller/a.py and models/controller/function/a.py - from mymodule import *, looks for mymodule in applications/thisapp/ modules first and then in sys.path. No more need for local_import. Thanks Pierre. - usage of generic.* views is - by default - restricted to localhost for security. This can be changed in a granular way with: response.generic_patterns=['*']. This is a slight change of behavior for new app but a major security fix. - all applications have cas 2.0 provider at http://.../user/cas/login - all applications can delegate to login to external provider Auth(...,cas_provider='http://.../other_app/default/user/cas') - A(...,callback=URL(...),larget='id') does Ajax - URL(...,user_signature=True), LOAD(...,user_signature=True) can sign urls and @auth.requires_signature() will check the signature for any decorated action. - DAL(...,migrate_enabled=False) to disable all migrations - DAL(...,fake_migrate_all=True) to rebuild all corrupted metadata - new DAL metadata format (databases/*.table) - DAL(...,adapter_arg={}) allows support for alternate drivers - DAL now allows circular table defintions - DAL(..,auto_import=True) automatically imports tables from metadata without need to db.define_table(...)s. - new alterante syntax for inner joins: db(...).select(join=...) - experimental cubrid database support - DAL 'request_tenant' fields are special, the altomatically filer all records based on their default value. - db._common_fields.append(Field('owner')) allows to add fields to ALL tables - DAL ignores repeated fields with same names - web2py_ajax.html is more modular, thanks Anthony - request.is_local - request.is_http - new sessions2trash.py thanks Jim Karsten - corrupted cache files are automatically deleted - new simpler API gluon.contrib.AuthorizeNet.procss(...) - fixed recaptcha (as they released new API) - messages in validators have default internationalization - No more Auth(globals(),db), just Auth(db). Same for Crud and Service. - scripts/access.wsgi allows apache+mod_wsgi to delegate authentication of any URL to any web2py app - json now supports T(...) - scripts/setup-web2py-nginx-uwsgi-ubuntu.sh - web2py HTTP responses now set: X-Powered-By: web2py, thanks Bruno - mostly fixed generic.pdf. You can view any page in PDF if you have pdflatex installed or if your html follows the pyfpdf convention. - auth.settings.extra_fields['auth_user'].append(Field('country')) allows to extend auth_* tables without need of definiting a custom auth_* table. Must be placed before auth.define_tables() - {{=response.toolbar()}} to help you debug applications - web based shell now supports object modifications (but no redefinitions of non-serializable types) - jQuery 1.6.1 - Lots of bug fixes
[web2py] new plugin_wiki
I also posted a new plugin wiki. It is not very different fixes a vulnerability by doing a digital signature of the jqGrid Ajax callback. Massimo
Re: [web2py] web2py 1.96.1 is OUT
Me does a dance. Thanks! - Original message - I could not wait any longer. We had so many changes that we need to move on. I do not recall any other release with so many new features. Thanks to all those who have contributed with patches and testing. Changelog: - from gluon import * imports in every python module a web2py environment (A, DIV,..SQLFORM, DAL, Field,...) including current.request, current.response, current.session, current.T, current.cache, thanks Jonathan. - conditional models in models/controller/a.py and models/controller/function/a.py - from mymodule import *, looks for mymodule in applications/thisapp/ modules first and then in sys.path. No more need for local_import. Thanks Pierre. - usage of generic.* views is - by default - restricted to localhost for security. This can be changed in a granular way with: response.generic_patterns=['*']. This is a slight change of behavior for new app but a major security fix. - all applications have cas 2.0 provider at http://.../user/cas/login - all applications can delegate to login to external provider Auth(...,cas_provider='http://.../other_app/default/user/cas') - A(...,callback=URL(...),larget='id') does Ajax - URL(...,user_signature=True), LOAD(...,user_signature=True) can sign urls and @auth.requires_signature() will check the signature for any decorated action. - DAL(...,migrate_enabled=False) to disable all migrations - DAL(...,fake_migrate_all=True) to rebuild all corrupted metadata - new DAL metadata format (databases/*.table) - DAL(...,adapter_arg={}) allows support for alternate drivers - DAL now allows circular table defintions - DAL(..,auto_import=True) automatically imports tables from metadata without need to db.define_table(...)s. - new alterante syntax for inner joins: db(...).select(join=...) - experimental cubrid database support - DAL 'request_tenant' fields are special, the altomatically filer all records based on their default value. - db._common_fields.append(Field('owner')) allows to add fields to ALL tables - DAL ignores repeated fields with same names - web2py_ajax.html is more modular, thanks Anthony - request.is_local - request.is_http - new sessions2trash.py thanks Jim Karsten - corrupted cache files are automatically deleted - new simpler API gluon.contrib.AuthorizeNet.procss(...) - fixed recaptcha (as they released new API) - messages in validators have default internationalization - No more Auth(globals(),db), just Auth(db). Same for Crud and Service. - scripts/access.wsgi allows apache+mod_wsgi to delegate authentication of any URL to any web2py app - json now supports T(...) - scripts/setup-web2py-nginx-uwsgi-ubuntu.sh - web2py HTTP responses now set: X-Powered-By: web2py, thanks Bruno - mostly fixed generic.pdf. You can view any page in PDF if you have pdflatex installed or if your html follows the pyfpdf convention. - auth.settings.extra_fields['auth_user'].append(Field('country')) allows to extend auth_* tables without need of definiting a custom auth_* table. Must be placed before auth.define_tables() - {{=response.toolbar()}} to help you debug applications - web based shell now supports object modifications (but no redefinitions of non-serializable types) - jQuery 1.6.1 - Lots of bug fixes
[web2py] SECURITY WARNING
we found two vulnerabilities that have been fixed in the latest release of web2py (1.96.1) and plugin_wiki (which requires web2py 1.96.1) ## Vulnerability 1 Consider this action def index(): a = 1 b = 2 return locals() and the view {{=a}} You clearly intended to expose only a, not b. But if you call the action with .json, both a and b will be serialized by the generic.json view. ### the fix generic view are now disabled by default. You can enable them from localhost with: response.generic_patterns = ['*'] if request.is_local else [] where '*' is a patter to be matched against the controller/ action.extension that you want to expose using generic views. ### comments Although we decided to classify this as a vulnerability, this actually was the intended behavior. Data returned by the view was to be considered readable to the user. We had a debate on web2py_developers whether this needed a fix. Turns out most people (including me) forgot about generic views and accidentally return data that they do not wish to expose. So now we ask developer to be more explicit about what they want to expose. ## vulnerability 2 This is not a web2py issue but a plugin_wiki issue. The plugin exposes a jQuery callback. Logged -in users (and only logged-i users) can exploit the callback to get read access to data they should not have access to. ### the fix simply upgrade plugin wiki. The new version used signed URLs to access the callback. Only the intended data is exposed. ### comments I remind you that plugin_wiki is not part of web2py and I still consider it experimental. The new plugin wiki requires web2py 1.96.1
Re: [web2py] web2py 1.96.1 is OUT
All new features will be documented? How will it be? Will be collaborative documentation? _ *Gilson Filho* *Web Developer http://gilsondev.com*
[web2py] Re: web2py 1.96.1 is OUT
Great release. I've been waiting for a stable release to move into production which I will probably stay with for awhile.
[web2py] Bug in MSSQLAdapter.EXTRACT
Hi This is using MS SQLServer 2000. qry = (db.my_table.my_datetime_field.year()==2011) rows = db(qry).select() This fails. db._lastsql output is equivalent to: SELECT * FROM my_table WHERE (DATEPART('year' FROM my_table.my_datetime_field) = 2011); The following works fine: SELECT * FROM my_table WHERE year(my_table.my_datetime_field) = 2011; in dal.py class MSSQLAdapter(BaseAdapter): replace def EXTRACT(self,field,what): return DATEPART('%s' FROM %s) % (what, self.expand(field)) with: def EXTRACT(self,field,what): return %s(%s) % (what, self.expand(field)) Again, this is with MS SQLServer 2000, I do not know if other versions will do the same. Jose
[web2py] web2py ENTERPRISE
One thing that would have asked you to Massimo but forgot that interviewhttp://blog.gilsondev.com/2011/01/13/interview-creator-of-web2py/ : Today web2py has left the classroom and entered into development companies worldwide. As a senior keeper, which you intend to do so that framework isrecommended as Django, etc? _ *Gilson Filho* *Web Developer http://gilsondev.com*
Re: [web2py] Re: Problems using LOAD function
I also posted a message yesterday regarding the views and the load function; It seems like if the URL has some additional 'args' LOAD returns the HTML view rather than the .load view. Thanks. On 6/1/11 2:23 PM, Massimo Di Pierro wrote: Please try LOAD('default','menu',ajax=True) you may get a ticket. Check what it says. On Jun 1, 12:34 pm, salbefesalb...@gmail.com wrote: Hello, The following code before I updated web2py via mercurial worked well for me. Now I get the following error if the ajax parameter is set to False. If is set to True, there is no error but the place where the view should be loaded is alway saying: loading... and nothing is showed. div class=unit div class=container div id=nav {{=LOAD('default','menu',ajax=False)}} /div /div /div Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /var/web2py/applications/init/views/default/ver_datos.html, line 61, inmodule td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td File /var/web2py/gluon/compileapp.py, line 135, in __call__ page = run_controller_in(c, f, other_environment) File /var/web2py/gluon/compileapp.py, line 429, in run_controller_in restricted(code, environment, filename) File /var/web2py/gluon/restricted.py, line 192, in restricted raise RestrictedError(layer, code, '', environment) RestrictedError Any help, please?? Thanks in advance
[web2py] Re: Bug in MSSQLAdapter.EXTRACT
Can you try replace: return DATEPART('%s' FROM %s) % (what, self.expand(field)) with return DATEPART(%s, %s) % (what, self.expand(field)) -- Forwarded message -- From: Jose jjac...@gmail.com Date: Jun 1, 2:05 pm Subject: Bug in MSSQLAdapter.EXTRACT To: web2py-users Hi This is using MS SQLServer 2000. qry = (db.my_table.my_datetime_field.year()==2011) rows = db(qry).select() This fails. db._lastsql output is equivalent to: SELECT * FROM my_table WHERE (DATEPART('year' FROM my_table.my_datetime_field) = 2011); The following works fine: SELECT * FROM my_table WHERE year(my_table.my_datetime_field) = 2011; in dal.py class MSSQLAdapter(BaseAdapter): replace def EXTRACT(self,field,what): return DATEPART('%s' FROM %s) % (what, self.expand(field)) with: def EXTRACT(self,field,what): return %s(%s) % (what, self.expand(field)) Again, this is with MS SQLServer 2000, I do not know if other versions will do the same. Jose
Re: [web2py] Re: Problems using LOAD function
To get .load view: LOAD('default','menu.load',ajax=False) or LOAD('default','menu',extension='load',ajax=False)
[web2py] Re: Bug in MSSQLAdapter.EXTRACT
On 1 jun, 16:18, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Can you try replace: return DATEPART('%s' FROM %s) % (what, self.expand(field)) with return DATEPART(%s, %s) % (what, self.expand(field)) I tried from the console, this work fine. SQL: select * FROM my_table WHERE DATEPART(year, my_table.my_datetime_field) = 2011; so your suggestion [1] should work. Jose [1] return DATEPART(%s, %s) % (what, self.expand(field))
[web2py] Re: Problems using LOAD function
I need more information here. Set ajax=True. What are the generated URLs (before and after the upgrade). I cannot reproduce the problem. LOAD('default','action') never appended the .load extension. You had to be explicit LOAD('default','action.load') Do you see the problem only with ajax=False? On Jun 1, 2:06 pm, David J. da...@styleflare.com wrote: I also posted a message yesterday regarding the views and the load function; It seems like if the URL has some additional 'args' LOAD returns the HTML view rather than the .load view. Thanks. On 6/1/11 2:23 PM, Massimo Di Pierro wrote: Please try LOAD('default','menu',ajax=True) you may get a ticket. Check what it says. On Jun 1, 12:34 pm, salbefesalb...@gmail.com wrote: Hello, The following code before I updated web2py via mercurial worked well for me. Now I get the following error if the ajax parameter is set to False. If is set to True, there is no error but the place where the view should be loaded is alway saying: loading... and nothing is showed. div class=unit div class=container div id=nav {{=LOAD('default','menu',ajax=False)}} /div /div /div Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /var/web2py/applications/init/views/default/ver_datos.html, line 61, inmodule td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td File /var/web2py/gluon/compileapp.py, line 135, in __call__ page = run_controller_in(c, f, other_environment) File /var/web2py/gluon/compileapp.py, line 429, in run_controller_in restricted(code, environment, filename) File /var/web2py/gluon/restricted.py, line 192, in restricted raise RestrictedError(layer, code, '', environment) RestrictedError Any help, please?? Thanks in advance
[web2py] Re: web2py 1.96.1 is OUT
Give it a day or to since new bugs always popup after a release with so many changes. On Jun 1, 1:56 pm, pbreit pbreitenb...@gmail.com wrote: Great release. I've been waiting for a stable release to move into production which I will probably stay with for awhile.
[web2py] Re: Bug in MSSQLAdapter.EXTRACT
fixed in trunk... I am sure we will have 1.96.2 soon although this is a pre-existing problem. On Jun 1, 2:28 pm, Jose jjac...@gmail.com wrote: On 1 jun, 16:18, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Can you try replace: return DATEPART('%s' FROM %s) % (what, self.expand(field)) with return DATEPART(%s, %s) % (what, self.expand(field)) I tried from the console, this work fine. SQL: select * FROM my_table WHERE DATEPART(year, my_table.my_datetime_field) = 2011; so your suggestion [1] should work. Jose [1] return DATEPART(%s, %s) % (what, self.expand(field))
[web2py] Re: web2py 1.96.1 is OUT
- URL(...,user_signature=True), LOAD(...,user_signature=True) can sign urls and @auth.requires_signature() will check the signature for any decorated action. Sorry for a stupid question but what is an url signature how does it work?
[web2py] Re: web2py 1.96.1 is OUT
Not a stupid question. Consider this code: def index(): if user_has_permission_to_call_other(): link = A('click',_href=URL('other')) else: link = DIV('do nothing') return dict() def other(): if not user_has_permission_to_call_other(): redirect(URL('index')) return dict() The code is checking twice whether the user_has_permission_to_call_other. You must check twice else you display the link to users who do not have access or you expose the url to users who do not have access. The same problem applies to callbacks. Now you can do: def index(): if user_has_permission_to_call_other(): link = A('click',_href=URL('other',user_signature=True)) else: link = DIV('do nothing') return dict() @auth.requires_signature() def other(): return dict() Now the check is done in one single place. The code is faster and cleaner. The url in the link is signed by appending a ?_signature=code that is only valid for this user during this session. Even if URL('other') where to be made public accidentally, nobody else could access it. The signature (the code string) is a HMAC hash using private key for the session. It contains a hash of the full url including all parameters passed to it. On Jun 1, 2:38 pm, szimszon szims...@gmail.com wrote: - URL(...,user_signature=True), LOAD(...,user_signature=True) can sign urls and @auth.requires_signature() will check the signature for any decorated action. Sorry for a stupid question but what is an url signature how does it work?
Re: [web2py] Re: Problems using LOAD function
I just upgraded the software to latest in trunk. I did explicitly use '.load'. It still happens. It loads the entire page into the target div. On 6/1/11 3:29 PM, Massimo Di Pierro wrote: I need more information here. Set ajax=True. What are the generated URLs (before and after the upgrade). I cannot reproduce the problem. LOAD('default','action') never appended the .load extension. You had to be explicit LOAD('default','action.load') Do you see the problem only with ajax=False? On Jun 1, 2:06 pm, David J.da...@styleflare.com wrote: I also posted a message yesterday regarding the views and the load function; It seems like if the URL has some additional 'args' LOAD returns the HTML view rather than the .load view. Thanks. On 6/1/11 2:23 PM, Massimo Di Pierro wrote: Please try LOAD('default','menu',ajax=True) you may get a ticket. Check what it says. On Jun 1, 12:34 pm, salbefesalb...@gmail.comwrote: Hello, The following code before I updated web2py via mercurial worked well for me. Now I get the following error if the ajax parameter is set to False. If is set to True, there is no error but the place where the view should be loaded is alway saying: loading... and nothing is showed. div class=unit div class=container div id=nav {{=LOAD('default','menu',ajax=False)}} /div /div /div Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /var/web2py/applications/init/views/default/ver_datos.html, line 61, inmodule td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td File /var/web2py/gluon/compileapp.py, line 135, in __call__ page = run_controller_in(c, f, other_environment) File /var/web2py/gluon/compileapp.py, line 429, in run_controller_in restricted(code, environment, filename) File /var/web2py/gluon/restricted.py, line 192, in restricted raise RestrictedError(layer, code, '', environment) RestrictedError Any help, please?? Thanks in advance
[web2py] Re: web2py 1.96.1 is OUT
from what I can see it pushes further variuos uses of the old functions from gluon.html import verifyURL to verify the hashed URL and URL(hmac_key='...') to generate the hashed one. Basically it's a method that appends a variable (as _signature=djhdsajhdasjhdasjhdas parameter in the URL) to allow only the designated user access the specified URL. (nice for protecting some ajax calls, for example ^_^) On 1 Giu, 21:38, szimszon szims...@gmail.com wrote: - URL(...,user_signature=True), LOAD(...,user_signature=True) can sign urls and @auth.requires_signature() will check the signature for any decorated action. Sorry for a stupid question but what is an url signature how does it work?
[web2py] Re: Problems using LOAD function
Please post the exact code you used {{=LOAD(.)}} the look at the source of the generated page and post that as well. On Jun 1, 2:58 pm, David J. da...@styleflare.com wrote: I just upgraded the software to latest in trunk. I did explicitly use '.load'. It still happens. It loads the entire page into the target div. On 6/1/11 3:29 PM, Massimo Di Pierro wrote: I need more information here. Set ajax=True. What are the generated URLs (before and after the upgrade). I cannot reproduce the problem. LOAD('default','action') never appended the .load extension. You had to be explicit LOAD('default','action.load') Do you see the problem only with ajax=False? On Jun 1, 2:06 pm, David J.da...@styleflare.com wrote: I also posted a message yesterday regarding the views and the load function; It seems like if the URL has some additional 'args' LOAD returns the HTML view rather than the .load view. Thanks. On 6/1/11 2:23 PM, Massimo Di Pierro wrote: Please try LOAD('default','menu',ajax=True) you may get a ticket. Check what it says. On Jun 1, 12:34 pm, salbefesalb...@gmail.com wrote: Hello, The following code before I updated web2py via mercurial worked well for me. Now I get the following error if the ajax parameter is set to False. If is set to True, there is no error but the place where the view should be loaded is alway saying: loading... and nothing is showed. div class=unit div class=container div id=nav {{=LOAD('default','menu',ajax=False)}} /div /div /div Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /var/web2py/applications/init/views/default/ver_datos.html, line 61, inmodule td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td File /var/web2py/gluon/compileapp.py, line 135, in __call__ page = run_controller_in(c, f, other_environment) File /var/web2py/gluon/compileapp.py, line 429, in run_controller_in restricted(code, environment, filename) File /var/web2py/gluon/restricted.py, line 192, in restricted raise RestrictedError(layer, code, '', environment) RestrictedError Any help, please?? Thanks in advance
[web2py] Re: Bug in MSSQLAdapter.EXTRACT
On 1 jun, 16:32, Massimo Di Pierro massimo.dipie...@gmail.com wrote: fixed in trunk... I am sure we will have 1.96.2 soon although this is a pre-existing problem. Work fine. Thanks. Jose
[web2py] Re: error on crud.update delete
just upgraded to 1.96.1 and the error is gone, the code was not special, but too complicated to post thanks for fixing this :D On Jun 1, 6:11 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: BTW... are you running stable. Can you try trunk. I remeber fixing something related to this. On May 31, 3:46 pm, selecta gr...@delarue-berlin.de wrote: ERROR:web2py:Traceback (most recent call last): File /home/select/Dev/web2py/gluon/restricted.py, line 181, in restricted exec ccode in environment File /home/select/Dev/web2py/applications/pyMantis/controllers/ plugin_whishlist.py, line 118, in module File /home/select/Dev/web2py/gluon/globals.py, line 133, in lambda self._caller = lambda f: f() File /home/select/Dev/web2py/gluon/tools.py, line 2335, in f return action(*a, **b) File /home/select/Dev/web2py/applications/pyMantis/controllers/ plugin_whishlist.py, line 68, in edit if form.accepts(request.vars, session): File /home/select/Dev/web2py/gluon/sqlhtml.py, line 1200, in accepts self.table._db(self.table.id == self.record.id).update(**fields) File /home/select/Dev/web2py/gluon/dal.py, line 5173, in update fields = self.db[tablename]._listify(update_fields,update=True) File /home/select/Dev/web2py/gluon/dal.py, line 4464, in _listify raise SyntaxError, 'Field %s does not belong to the table' % name SyntaxError: Field delete_this_record does not belong to the table is this somehow my fault? not sure how to debug
Re: [web2py] Re: Problems using LOAD function
a href=javascript:web2py_component('quick_add_contact.load','contact_list') class=buttonQuick Add New Contacts/a On 6/1/11 4:02 PM, Massimo Di Pierro wrote: Please post the exact code you used {{=LOAD(.)}} the look at the source of the generated page and post that as well. On Jun 1, 2:58 pm, David J.da...@styleflare.com wrote: I just upgraded the software to latest in trunk. I did explicitly use '.load'. It still happens. It loads the entire page into the target div. On 6/1/11 3:29 PM, Massimo Di Pierro wrote: I need more information here. Set ajax=True. What are the generated URLs (before and after the upgrade). I cannot reproduce the problem. LOAD('default','action') never appended the .load extension. You had to be explicit LOAD('default','action.load') Do you see the problem only with ajax=False? On Jun 1, 2:06 pm, David J.da...@styleflare.comwrote: I also posted a message yesterday regarding the views and the load function; It seems like if the URL has some additional 'args' LOAD returns the HTML view rather than the .load view. Thanks. On 6/1/11 2:23 PM, Massimo Di Pierro wrote: Please try LOAD('default','menu',ajax=True) you may get a ticket. Check what it says. On Jun 1, 12:34 pm, salbefesalb...@gmail.com wrote: Hello, The following code before I updated web2py via mercurial worked well for me. Now I get the following error if the ajax parameter is set to False. If is set to True, there is no error but the place where the view should be loaded is alway saying: loading... and nothing is showed. div class=unit div class=container div id=nav {{=LOAD('default','menu',ajax=False)}} /div /div /div Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /var/web2py/applications/init/views/default/ver_datos.html, line 61, inmodule td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td File /var/web2py/gluon/compileapp.py, line 135, in __call__ page = run_controller_in(c, f, other_environment) File /var/web2py/gluon/compileapp.py, line 429, in run_controller_in restricted(code, environment, filename) File /var/web2py/gluon/restricted.py, line 192, in restricted raise RestrictedError(layer, code, '', environment) RestrictedError Any help, please?? Thanks in advance
[web2py] Re: web2py 1.96.1 is OUT
auth.settings.extra_fields['auth_user'].append(Field('country')) does this new release allow me to remove fields from the auth table? e.g. auth.settings.extra_fields['auth_user'].remove(Field('country'))? Thanks Max, great release.
[web2py] Re: How do we handle concurrent db update?
I don't know very well web2py internals (in the book at chapter 04 seems to behave like all operations inside a function are executed inside a transaction, if an exception raises all opened transaction are rollbacked). If it is like explained in web2py book this is the right way to do normal transactions in a stateless world (like the web one). In this default behaviour, if Alice hasn't finished the function and Bob starts the same function, sure there will happen race conditions (Bob istantiate a transaction while Alice's one is not committed yet) chapter/06#commit-and-rollback gives you a hint... If you need to avoid the behaviour you explained, you need a different table design, but for the sake of discussion.: before showing you booked resource X, wouldn't db.commit() and re-selecting the record watching again the occupied value solve the problem ? On 1 Giu, 07:40, Mathew Grabau grabau@gmail.com wrote: Yes - that is exactly the problem that transactions are intended to take care of. What would writing raw SQL do? Raw SQL statements (unless explicitly contained in a transaction) would be executed outside of the transaction and therefore still vulnerable. On May 31, 6:57 pm, David J da...@styleflare.com wrote: I am confused. Isn't this exactly what transactions are for? On May 31, 2011 7:54 PM, pbreit pbreitenb...@gmail.com wrote: We aren't talking about a bank account (and even if we were, that's why banks rely on reconciliation procedures), we are talking about a booking system. It's like security, you're never 100%, just as close to 100% as you need to be.
[web2py] Re: Problems using LOAD function
David and salbefe have different issues. @David web2py_component('quick_add_contact.load','contact_list') should be web2py_component('{{=URL('quick_add_contact.load'}}','contact_list') @salbefe what do you get if you visit this page? http:///init/default/menu My guess is you get a not-authorized error. On Jun 1, 3:16 pm, David J. da...@styleflare.com wrote: a href=javascript:web2py_component('quick_add_contact.load','contact_list') class=buttonQuick Add New Contacts/a On 6/1/11 4:02 PM, Massimo Di Pierro wrote: Please post the exact code you used {{=LOAD(.)}} the look at the source of the generated page and post that as well. On Jun 1, 2:58 pm, David J.da...@styleflare.com wrote: I just upgraded the software to latest in trunk. I did explicitly use '.load'. It still happens. It loads the entire page into the target div. On 6/1/11 3:29 PM, Massimo Di Pierro wrote: I need more information here. Set ajax=True. What are the generated URLs (before and after the upgrade). I cannot reproduce the problem. LOAD('default','action') never appended the .load extension. You had to be explicit LOAD('default','action.load') Do you see the problem only with ajax=False? On Jun 1, 2:06 pm, David J.da...@styleflare.com wrote: I also posted a message yesterday regarding the views and the load function; It seems like if the URL has some additional 'args' LOAD returns the HTML view rather than the .load view. Thanks. On 6/1/11 2:23 PM, Massimo Di Pierro wrote: Please try LOAD('default','menu',ajax=True) you may get a ticket. Check what it says. On Jun 1, 12:34 pm, salbefesalb...@gmail.com wrote: Hello, The following code before I updated web2py via mercurial worked well for me. Now I get the following error if the ajax parameter is set to False. If is set to True, there is no error but the place where the view should be loaded is alway saying: loading... and nothing is showed. div class=unit div class=container div id=nav {{=LOAD('default','menu',ajax=False)}} /div /div /div Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /var/web2py/applications/init/views/default/ver_datos.html, line 61, inmodule td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td File /var/web2py/gluon/compileapp.py, line 135, in __call__ page = run_controller_in(c, f, other_environment) File /var/web2py/gluon/compileapp.py, line 429, in run_controller_in restricted(code, environment, filename) File /var/web2py/gluon/restricted.py, line 192, in restricted raise RestrictedError(layer, code, '', environment) RestrictedError Any help, please?? Thanks in advance
[web2py] Re: web2py 1.96.1 is OUT
You can add fields before the table is defined. You cannot add or remove fields after the table is defined. You also cannot remove fields before the table is defined. I could add this but it would be less transparent that just make a custom table. On Jun 1, 3:31 pm, Pystar aitoehi...@gmail.com wrote: auth.settings.extra_fields['auth_user'].append(Field('country')) does this new release allow me to remove fields from the auth table? e.g. auth.settings.extra_fields['auth_user'].remove(Field('country'))? Thanks Max, great release.
[web2py] Re: Problems using LOAD function
What happens when you go to http://127.0.0.1/init/default/menu or http://127.0.0.1/init/default/menu.html or http://127.0.0.1 /init/default/menu.load in your browser? Do you have a view menu.html or menu.load? Have you tried LOAD('default','menu.load',ajax=False)
Re: [web2py] Re: Problems using LOAD function
Massimo; Thank you! It seems to have solved my particular issue; @David On 6/1/11 4:48 PM, Massimo Di Pierro wrote: David and salbefe have different issues. @David web2py_component('quick_add_contact.load','contact_list') should be web2py_component('{{=URL('quick_add_contact.load'}}','contact_list') @salbefe what do you get if you visit this page? http:///init/default/menu My guess is you get a not-authorized error. On Jun 1, 3:16 pm, David J.da...@styleflare.com wrote: a href=javascript:web2py_component('quick_add_contact.load','contact_list') class=buttonQuick Add New Contacts/a On 6/1/11 4:02 PM, Massimo Di Pierro wrote: Please post the exact code you used {{=LOAD(.)}} the look at the source of the generated page and post that as well. On Jun 1, 2:58 pm, David J.da...@styleflare.comwrote: I just upgraded the software to latest in trunk. I did explicitly use '.load'. It still happens. It loads the entire page into the target div. On 6/1/11 3:29 PM, Massimo Di Pierro wrote: I need more information here. Set ajax=True. What are the generated URLs (before and after the upgrade). I cannot reproduce the problem. LOAD('default','action') never appended the .load extension. You had to be explicit LOAD('default','action.load') Do you see the problem only with ajax=False? On Jun 1, 2:06 pm, David J.da...@styleflare.com wrote: I also posted a message yesterday regarding the views and the load function; It seems like if the URL has some additional 'args' LOAD returns the HTML view rather than the .load view. Thanks. On 6/1/11 2:23 PM, Massimo Di Pierro wrote: Please try LOAD('default','menu',ajax=True) you may get a ticket. Check what it says. On Jun 1, 12:34 pm, salbefesalb...@gmail.comwrote: Hello, The following code before I updated web2py via mercurial worked well for me. Now I get the following error if the ajax parameter is set to False. If is set to True, there is no error but the place where the view should be loaded is alway saying: loading... and nothing is showed. div class=unit div class=container div id=nav {{=LOAD('default','menu',ajax=False)}} /div /div /div Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /var/web2py/applications/init/views/default/ver_datos.html, line 61, inmodule td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td File /var/web2py/gluon/compileapp.py, line 135, in __call__ page = run_controller_in(c, f, other_environment) File /var/web2py/gluon/compileapp.py, line 429, in run_controller_in restricted(code, environment, filename) File /var/web2py/gluon/restricted.py, line 192, in restricted raise RestrictedError(layer, code, '', environment) RestrictedError Any help, please?? Thanks in advance
[web2py] Re: web2py 1.96.1 is OUT
I saw in the changesets some notes about salts and smart_hashes. Is it now possible to salt password hashes?
[web2py] Re: web2py 1.96.1 is OUT
Ok, if I can not do auth.settings.extra_fields['auth_user'].remove(Field('country'))? can I do something like similar to this SQLFORM(database.table, fields[a, b])? Since I can not remove fields from the auth table, then I can add the fields I want and display them only. Thanks On Jun 1, 9:56 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: You can add fields before the table is defined. You cannot add or remove fields after the table is defined. You also cannot remove fields before the table is defined. I could add this but it would be less transparent that just make a custom table. On Jun 1, 3:31 pm, Pystar aitoehi...@gmail.com wrote: auth.settings.extra_fields['auth_user'].append(Field('country')) does this new release allow me to remove fields from the auth table? e.g. auth.settings.extra_fields['auth_user'].remove(Field('country'))? Thanks Max, great release.
[web2py] Re: web2py 1.96.1 is OUT
There is nothing new in this respect. I think you can salt the password in this way: import uuid session._salt = session._salt or str(uuid.uuid4() auth.settings.extra_fields['auth_user'].append(Field('salt',writable=False,readable=False,default=session._salt)) auth.define_tables() ... if auth.user: session._salt=auth.user.salt db.auth_user.password.requires=CRYPT(auth.settings.hmac_key +session._salt) give it a try. On Jun 1, 4:02 pm, pbreit pbreitenb...@gmail.com wrote: I saw in the changesets some notes about salts and smart_hashes. Is it now possible to salt password hashes?
[web2py] Re: Problems using LOAD function
Massimo, I have solved muy problem. My problem was that I had migrate=False in the table 'menu' on db.py and I was using an older version of the database where such table did not exist. Sorry for the inconveniencie. When I have tried to visit http:///init/default/menu is when I noticed myself. Thanks for all On 1 jun, 22:48, Massimo Di Pierro massimo.dipie...@gmail.com wrote: David and salbefe have different issues. @David web2py_component('quick_add_contact.load','contact_list') should be web2py_component('{{=URL('quick_add_contact.load'}}','contact_list') @salbefe what do you get if you visit this page? http:///init/default/menu My guess is you get a not-authorized error. On Jun 1, 3:16 pm, David J. da...@styleflare.com wrote: a href=javascript:web2py_component('quick_add_contact.load','contact_list') class=buttonQuick Add New Contacts/a On 6/1/11 4:02 PM, Massimo Di Pierro wrote: Please post the exact code you used {{=LOAD(.)}} the look at the source of the generated page and post that as well. On Jun 1, 2:58 pm, David J.da...@styleflare.com wrote: I just upgraded the software to latest in trunk. I did explicitly use '.load'. It still happens. It loads the entire page into the target div. On 6/1/11 3:29 PM, Massimo Di Pierro wrote: I need more information here. Set ajax=True. What are the generated URLs (before and after the upgrade). I cannot reproduce the problem. LOAD('default','action') never appended the .load extension. You had to be explicit LOAD('default','action.load') Do you see the problem only with ajax=False? On Jun 1, 2:06 pm, David J.da...@styleflare.com wrote: I also posted a message yesterday regarding the views and the load function; It seems like if the URL has some additional 'args' LOAD returns the HTML view rather than the .load view. Thanks. On 6/1/11 2:23 PM, Massimo Di Pierro wrote: Please try LOAD('default','menu',ajax=True) you may get a ticket. Check what it says. On Jun 1, 12:34 pm, salbefesalb...@gmail.com wrote: Hello, The following code before I updated web2py via mercurial worked well for me. Now I get the following error if the ajax parameter is set to False. If is set to True, there is no error but the place where the view should be loaded is alway saying: loading... and nothing is showed. div class=unit div class=container div id=nav {{=LOAD('default','menu',ajax=False)}} /div /div /div Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 184, in restricted exec ccode in environment File /var/web2py/applications/init/views/default/ver_datos.html, line 61, inmodule td{{=locale.format(%.*f,(4,linea.vel_sonido),True)}}/td File /var/web2py/gluon/compileapp.py, line 135, in __call__ page = run_controller_in(c, f, other_environment) File /var/web2py/gluon/compileapp.py, line 429, in run_controller_in restricted(code, environment, filename) File /var/web2py/gluon/restricted.py, line 192, in restricted raise RestrictedError(layer, code, '', environment) RestrictedError Any help, please?? Thanks in advance
[web2py] Re: web2py 1.96.1 is OUT
Hi, please, give some comments about new features: - from gluon import * imports in every python module a web2py environment (A, DIV,..SQLFORM, DAL, Field,...) including current.request, current.response, current.session, current.T, current.cache, thanks Jonathan. While using ide's like pycharm, there are some problems with completion and discover of web2py internal variables like request, response, this new feature should improve ide support, but it's happened so that in the code we use response and request, and from gluon import * feature imports current.response and current.request. How can I fix this? I mean what should I place in gluon to help ide understand request without current? - request.is_local If I understand correctly this function checks whether app is working on localhost, if so, then maybe it will be really simple to add another feature - while working on localhost(mostly development mode), when something raises an error, show not link to ticket, but straight debug info page, just skip clicking on ticket link step - this will speed up dev process. Thank you for making web2py better )
Re: [web2py] Re: jquery effect
thank you so much for your hints, i'm using select input with 3 options, public, private and protected, on the form. so when user choose the protected value the field password will appears. i just modified what was written on the book. any idea? thank you so much in advance. On Thu, Jun 2, 2011 at 12:07 AM, Ross Peoples ross.peop...@gmail.comwrote: I'm not exactly sure what's going here, but at first glance, this is what I see: I think you are using attr() wrong. In the first section of code, you are checking the 'Protected' attribute, but in the second block of code, you are setting an 'onchange' attribute to the value of 'Protected', Maybe this should read attr('Protected', true) instead?
[web2py] how to upgrade Web2py in Webfaction?
Hello given that 1.96.1 has been just released, i am trying to upgrade it in webfaction via the web2py admin site. However when pressing the button to upgrade, i get this message: *unable to upgrade because [Errno 2] No such file or directory: '/home/webteamco/webapps/web2py/web2py/gluon/tests/__init__.py'* Any clues on how to procede?
Re: [web2py] how to upgrade Web2py in Webfaction?
have you tried to create the gluon/tests/__init__.py file? -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ] On Wed, Jun 1, 2011 at 6:55 PM, JorgeH jorgeh...@gmail.com wrote: *n/tests/__init__.py*
Re: [web2py] how to upgrade Web2py in Webfaction?
hmmm nope