[web2py] Re: cursor already closed
some more details: the problem occurs from the second time I use the controller functionupload_anagrafica thanks a lot Manuele # model # db.define_table('site', Field('name', length=16, required=True, unique=True, label=T('Nome')), # - si potrebbe usare una formula che toglie gli spazi Field('longitude', 'decimal(6,3)', requires=IS_DECIMAL_IN_RANGE(-180, 180, error_message=T('Not a valid integeritude value inserted!')), label=T('Longitudine'), comment='°'), Field('latitude', 'decimal(6,3)', requires=IS_DECIMAL_IN_RANGE(-90, 90, error_message=T('Not a valid Latitude value inserted!')), label=T('Latitudine'), comment='°'), Field('height', 'integer', requires = IS_INT_IN_RANGE(0, 8900, error_message=T('Height value out of reasonable range [0-8900]!')), label=T('Quota'), comment='m s.l.m.'), Field('code', length=15,required=True, unique=True, requires = IS_UPPER(), label=T('Codice'), comment=T('Codice univoco di identificazione sito')), Field('full_name', length=64, label=T('Nome completo')), #Field('start_validity', 'datetime', label=T('Aggiornamento'), comment=T('Data di aggiornamento delle informazioni')), link_to_company, auth.signature.created_on, auth.signature.modified_on, auth.signature.created_by, auth.signature.modified_by, format = '%(full_name)s', migrate=settings.migrate ) # module: meteo.py ## class IntegrityError: pass class superPower(object): def __init__(self, table, *uniques): self.table_name = table._tablename self._table = table self._db = table._db self.uniques = uniques class superPowerSite(superPower): ok_tabs = ('site', ) def __init__(self, table, unique): superPower.__init__(self, table, unique) self.unique = unique if self.table_name not in self.ok_tabs: raise IOError if not unique in [field for field in self._table.fields if self._table[field].unique]: raise IOError def import_anagrafica(self, path_to_file, owner_company): f = open(path_to_file, 'r') header = f.readline() for line in f: infos = dict(zip(self._table.fields[1:7], \ [x.strip() for x in line.split(';')[1:]])) if len(infos) == 6: infos[self._table.fields[7]] = owner_company try: self._table.insert(**infos) except: #IntegrityError: self._db(self._table[self.unique]==infos[self.unique]).update(**infos) # controller: setup.py ## from pytz import timezone #@auth.requires_membership('admin') def upload_anagrafica(): uploadPath = os.path.join(request.folder,'uploads/anagrafica') if not os.path.exists(uploadPath): os.makedirs(uploadPath) form = SQLFORM.factory( Field('anagrafica', 'upload', uploadfolder=uploadPath, label='File', comment=T('Carica file di anagrafica')), #Field('start_validity', 'date', default=dt.date.today(), requires=IS_DATE(format=T('%d/%m/%Y')), #label=T('Aggiornamento'), comment=T('specificare la data di inizio validità del file di anagrafica che si sta caricando.')), link_to_company ) if form.accepts(request.vars): response.flash = T('Form compilato correttamente.') #start_validity = timezone('Europe/Rome').localize(dt.datetime.combine(form.vars.start_validity, dt.time(0, 0))).astimezone(timezone('UTC')) #path_to_file = uploadPath + form.vars.anagrafica path_to_file = os.path.join(uploadPath, form.vars.anagrafica) #anagrafica().Import(path_to_file, form.vars.owner_company) print path_to_file, form.vars.owner_company site = superPowerSite(db.site, 'code') site.import_anagrafica(path_to_file, form.vars.owner_company) return dict(form=form)
Re: [web2py] Re: Working with CAS
Massimo, Thanks for your reply now I am working with new version 1.96.4 but now as given in cas_auth.py I have update my db.py with from gluon.contrib.login_methods.cas_auth import CasAuth auth.define_tables(username=True) auth.settings.login_form=CasAuth( urlbase = http://127.0.0.1:8000/casapp2/default/user/cas ,actions=['login','validate','logout']) still geting error: Below is the tracebak Traceback (most recent call last): File D:\web2py_src_1.96.4\web2py\gluon\restricted.py, line 192, in restricted exec ccode in environment File D:/web2py_src_1.96.4/web2py/applications/casapp1/controllers/default.py http://127.0.0.1:8000/admin/default/edit/casapp1/controllers/default.py, line 91, in module File D:\web2py_src_1.96.4\web2py\gluon\globals.py, line 137, in lambda self._caller = lambda f: f() File D:/web2py_src_1.96.4/web2py/applications/casapp1/controllers/default.py http://127.0.0.1:8000/admin/default/edit/casapp1/controllers/default.py, line 53, in user return dict(form=auth()) File D:\web2py_src_1.96.4\web2py\gluon\tools.py, line 1069, in __call__ return getattr(self,args[0])() File D:\web2py_src_1.96.4\web2py\gluon\tools.py, line 1631, in login redirect(cas.login_url(next)) File D:\web2py_src_1.96.4\web2py\gluon\contrib\login_methods\cas_auth.py, line 62, in login_url current.session.token=self._CAS_login() File D:\web2py_src_1.96.4\web2py\gluon\contrib\login_methods\cas_auth.py, line 116, in _CAS_login except ExpatError: pass NameError: global name 'ExpatError' is not defined -- Forwarded message -- From: Massimo Di Pierro massimo.dipie...@gmail.com Date: Wed, Jun 22, 2011 at 8:38 PM Subject: [web2py] Re: Working with CAS To: web2py-users web2py@googlegroups.com From this error: giving me err in auth.settings.cas_domains.append AttributeError: 'NoneType' object has no attribute 'append' I believe you are running an old version of web2py that does not support the new CAS mechanism. Please try the latest one. On Jun 22, 9:50 am, sagar browse2sa...@gmail.com wrote: Hi I am trying to using use cas as given in online document when I am using this : CAS.login_url='https://www.web2py.com/cas/cas/login' CAS.check_url='https://www.web2py.com/cas/cas/check' CAS.logout_url='https://www.web2py.com/cas/cas/logout' CAS.my_url='http://127.0.0.1:8000/testauth/default/user/login' if not session.token and not request.function=='login': redirect(URL('login')) def login(): session.token=CAS.login(request) id,email,name=session.token return dict() def logout(): session.token=None CAS.logout() when i doing this come to know that web2py app now has a built-in CAS consumer and provider while trying this(as per given there) auth.settings.cas_domains.append('http://consumer.com') Consumer how to: auth = Auth(db,cas_provider='http://provider.com/providerapp/default/ user/cas') giving me err in auth.settings.cas_domains.append AttributeError: 'NoneType' object has no attribute 'append' And while trying this one earliar from your post In app1 db.py from gluon.contrib.login_methods.cas_auth import CasAuth auth.define_tables(username=True) auth.settings.login_form=CasAuth(globals(),urlbase = http:// 127.0.0.1:8000/app2/default/user/login, actions=['login','check','logout']) I got authenticated at app2 but not got redirected to app1. Please help How to get CAS working?
Re: [web2py] Re: Working with CAS
Its done there was some setting issues. On Thu, Jun 23, 2011 at 1:16 PM, sagar nigade browse2sa...@gmail.comwrote: Massimo, Thanks for your reply now I am working with new version 1.96.4 but now as given in cas_auth.py I have update my db.py with from gluon.contrib.login_methods.cas_auth import CasAuth auth.define_tables(username=True) auth.settings.login_form=CasAuth( urlbase = http://127.0.0.1:8000/casapp2/default/user/cas ,actions=['login','validate','logout']) still geting error: Below is the tracebak Traceback (most recent call last): File D:\web2py_src_1.96.4\web2py\gluon\restricted.py, line 192, in restricted exec ccode in environment File D:/web2py_src_1.96.4/web2py/applications/casapp1/controllers/default.py http://127.0.0.1:8000/admin/default/edit/casapp1/controllers/default.py, line 91, in module File D:\web2py_src_1.96.4\web2py\gluon\globals.py, line 137, in lambda self._caller = lambda f: f() File D:/web2py_src_1.96.4/web2py/applications/casapp1/controllers/default.py http://127.0.0.1:8000/admin/default/edit/casapp1/controllers/default.py, line 53, in user return dict(form=auth()) File D:\web2py_src_1.96.4\web2py\gluon\tools.py, line 1069, in __call__ return getattr(self,args[0])() File D:\web2py_src_1.96.4\web2py\gluon\tools.py, line 1631, in login redirect(cas.login_url(next)) File D:\web2py_src_1.96.4\web2py\gluon\contrib\login_methods\cas_auth.py, line 62, in login_url current.session.token=self._CAS_login() File D:\web2py_src_1.96.4\web2py\gluon\contrib\login_methods\cas_auth.py, line 116, in _CAS_login except ExpatError: pass NameError: global name 'ExpatError' is not defined -- Forwarded message -- From: Massimo Di Pierro massimo.dipie...@gmail.com Date: Wed, Jun 22, 2011 at 8:38 PM Subject: [web2py] Re: Working with CAS To: web2py-users web2py@googlegroups.com From this error: giving me err in auth.settings.cas_domains.append AttributeError: 'NoneType' object has no attribute 'append' I believe you are running an old version of web2py that does not support the new CAS mechanism. Please try the latest one. On Jun 22, 9:50 am, sagar browse2sa...@gmail.com wrote: Hi I am trying to using use cas as given in online document when I am using this : CAS.login_url='https://www.web2py.com/cas/cas/login' CAS.check_url='https://www.web2py.com/cas/cas/check' CAS.logout_url='https://www.web2py.com/cas/cas/logout' CAS.my_url='http://127.0.0.1:8000/testauth/default/user/login' if not session.token and not request.function=='login': redirect(URL('login')) def login(): session.token=CAS.login(request) id,email,name=session.token return dict() def logout(): session.token=None CAS.logout() when i doing this come to know that web2py app now has a built-in CAS consumer and provider while trying this(as per given there) auth.settings.cas_domains.append('http://consumer.com') Consumer how to: auth = Auth(db,cas_provider='http://provider.com/providerapp/default/ user/cas') giving me err in auth.settings.cas_domains.append AttributeError: 'NoneType' object has no attribute 'append' And while trying this one earliar from your post In app1 db.py from gluon.contrib.login_methods.cas_auth import CasAuth auth.define_tables(username=True) auth.settings.login_form=CasAuth(globals(),urlbase = http:// 127.0.0.1:8000/app2/default/user/login, actions=['login','check','logout']) I got authenticated at app2 but not got redirected to app1. Please help How to get CAS working?
[web2py] Re: The multi-tenant feature and validators ...
I used this feature like this: db._common_fields.append(Field('request_tenant',default=auth.user_id,writable=False,readable=False)) so every user would have it's own data. It seeams that IS_IN_DB is not aware of the request_tenant and also if you mark a filed as unique it will be unique across accounts. So it will say some data is not unique even if I have not entered it before but someone else did.
[web2py] Re: web2py and async monkey patching
Thanks for the reply. So what anyserver.py does with gevent is not recommended? It calls monkey.patch_all() which patches threading to use green threads. Is this something that ought to work but is just untested? web2py is pure python so the monkey patching should make thread locals into greenlet locals, right? If that is so, then is the testing something I could do myself, or does it need to be done by someone who knows the internals of web2py? Graeme On Jun 23, 8:10 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I am not sure this does not break the new internal web2py design that uses thread locals. I would not use async unless we have tested this more. Massimo On Jun 22, 6:44 pm, graeme graeme.piete...@gmail.com wrote: I can see that anyserver.py uses monkey patching to make the standard library cooperative with gevent. Could the same be done with eventlet and with Gunicorn (with eventlet, gevent or both)? Eventlet has the advantages of being (AFAIK) pure python, and can monkey patch psycopg as well as the standard library. Has anyone measured whether it is significantly more memory efficient to run web2py on green threads? My use case is that I will have long running controllers (while fetching data from web services). I would like it to be memory efficient, but I am nt* looking for massive scalability or extreme speed. I do not want it to be trivial to DOS (so I need either threads or green threads to handle the long running controllers).
[web2py] Legacy database adaptation in web2py, best way?
So we have a legacy database that has a suboptimal structure, but we cannot change it right now. What we want is to create a business layer in-between web2py and this database so that web2py thinks it is using a much better database structure in order for the development in web2py to be what we want the end result to be when the database is finally restructured. By defining a sort of virtual model in web2py (that is more how we want the final database to look like) we can use the benefit of creating forms very easily in web2py, and then just forward the results to the business layer and let it take care of the real database. But problems arise when the web2py forms etc. assumes that the model really has a physical database behind it, for instance the CRUD forms where the crud.update gathers info on the record from database and puts it in the form automatically. We want this of course but the web2py model has no real database. One way of doing this would be to use SQLFORM.factory and manually inserting all the values into the inputs like so: inputs = form.elements('input') inputs[0]['_value'] = user.name inputs[1]['_value'] = user.email ... but this sort of manual work seems unnecessary for big forms Another problem I had with CRUD forms in my case is that I really want to make the if .accepts() call myself so that I can then call the business layer with the database related stuff, but it seems the CRUD forms do this call automatically? In the case of SQLFORM.factory forms I can make the .accepts myself Do any of you have experience in these kinds of problems? Is there a painless way to do it? I would be most thankful for any tips regarding this
[web2py] Running web2py on Jython
Hi, has anyone running a reasonably current version of web2py running on Jython 2.5.x? I need help with this. From reading the available information on the web I gained the impression that Jython 2.5 is a fully supported platform. Wikipedia says web2py since v1.64.0 runs unmodified on Java with Jython 2.5, without any known limitation. The Official (3rd Ed.) web2py Book seems to support this claim, although the installation instructions seem to be a bit outdated (zxJDBC is included in the 2.5.x Jython install Jar, no need to install it separately). The problem is, my experiences so far are very different. Here is the reason why I am asking for help. I am facing a situation where I want to have web2py running on a Linux host on which I have no admin rights. The problem is that this machine has only Python 2.4 installed. Although web2py claims to be running on Python 2.4, it really doesn't out of the box. A backported hashlib module would have to be additionally installed. This doesn't seem to be a viable option for me, given my limited admin rights on this machine. A Jython install on the other hand should pose no problem. The additional gain of this approach is, Jython 2.5 is an officially supported Python version (2.5.2), Python 2.4 is not. I can only try this next week for real, but I did some preliminary tests on my local machine during the last few days. I tried on Windows XP with Jython 2.5.0/ 2.5.1/ 2.5.2. I tested on an old (but updated) Ubuntu installation with Jython 2.5.2. I tested on a Linux VM running on Virtualbox 4.0.8. The consistent result for me was that the current web2py releases don't work on Jython. For example with R-1.90.2 and later the welcome app shows immediately (on first access) a ticket. Root cause has something to do with the sqlite driver ('com.ziclix.python.sql.PyConnection' object has no attribute 'create_function'). Even older versions seem to raise exceptions with tracebacks shown in the Jython console, hinting to 'rocket' and 'multithreading'. Details available upon request. The most 'recent' version of web2py that seems to be running with Jython 2.5.x seems to be 1.85.2 (hg commit #907). Even #918 seems to be working fine. Later versions don't. I diffed the sources, but somehow couldn't make sense of it. So that is where I am standing now. What I am doing wrong? I seem to be quite alone with my experiences since Google didn't provide pointers to fellow sufferers. To reiterate my question: Has anyone running a reasonably current version of web2py running on Jython 2.5.x? Regards, Richard
[web2py] ekjaa
How is behind it? http://www.ekjaa.org/ Really good job! massimo
[web2py] Re: The multi-tenant feature and validators ...
Please open a ticket and I will fix it. On Jun 23, 5:19 am, rif feric...@gmail.com wrote: I used this feature like this: db._common_fields.append(Field('request_tenant',default=auth.user_id,writab le=False,readable=False)) so every user would have it's own data. It seeams that IS_IN_DB is not aware of the request_tenant and also if you mark a filed as unique it will be unique across accounts. So it will say some data is not unique even if I have not entered it before but someone else did.
[web2py] Re: web2py and async monkey patching
The test is easy: def index(): import time from gluon import current print current.request.uuid sleep(10) print current.request.uuid return 'done!' call this action twice from console within less then 10 seconds from each other what is the output? if it looks A B A B than the monkey patching is correct if it looks like A B B B then it is not. If it looks like A A B B then we are not testing right. A,B are uuids. massimo On Jun 23, 5:22 am, graeme graeme.piete...@gmail.com wrote: Thanks for the reply. So what anyserver.py does with gevent is not recommended? It calls monkey.patch_all() which patches threading to use green threads. Is this something that ought to work but is just untested? web2py is pure python so the monkey patching should make thread locals into greenlet locals, right? If that is so, then is the testing something I could do myself, or does it need to be done by someone who knows the internals of web2py? Graeme On Jun 23, 8:10 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I am not sure this does not break the new internal web2py design that uses thread locals. I would not use async unless we have tested this more. Massimo On Jun 22, 6:44 pm, graeme graeme.piete...@gmail.com wrote: I can see that anyserver.py uses monkey patching to make the standard library cooperative with gevent. Could the same be done with eventlet and with Gunicorn (with eventlet, gevent or both)? Eventlet has the advantages of being (AFAIK) pure python, and can monkey patch psycopg as well as the standard library. Has anyone measured whether it is significantly more memory efficient to run web2py on green threads? My use case is that I will have long running controllers (while fetching data from web services). I would like it to be memory efficient, but I am nt* looking for massive scalability or extreme speed. I do not want it to be trivial to DOS (so I need either threads or green threads to handle the long running controllers).
[web2py] Re: Running web2py on Jython
I have not tried in some time.What errors do you get? On Jun 23, 3:50 am, Richard richb...@gmail.com wrote: Hi, has anyone running a reasonably current version of web2py running on Jython 2.5.x? I need help with this. From reading the available information on the web I gained the impression that Jython 2.5 is a fully supported platform. Wikipedia says web2py since v1.64.0 runs unmodified on Java with Jython 2.5, without any known limitation. The Official (3rd Ed.) web2py Book seems to support this claim, although the installation instructions seem to be a bit outdated (zxJDBC is included in the 2.5.x Jython install Jar, no need to install it separately). The problem is, my experiences so far are very different. Here is the reason why I am asking for help. I am facing a situation where I want to have web2py running on a Linux host on which I have no admin rights. The problem is that this machine has only Python 2.4 installed. Although web2py claims to be running on Python 2.4, it really doesn't out of the box. A backported hashlib module would have to be additionally installed. This doesn't seem to be a viable option for me, given my limited admin rights on this machine. A Jython install on the other hand should pose no problem. The additional gain of this approach is, Jython 2.5 is an officially supported Python version (2.5.2), Python 2.4 is not. I can only try this next week for real, but I did some preliminary tests on my local machine during the last few days. I tried on Windows XP with Jython 2.5.0/ 2.5.1/ 2.5.2. I tested on an old (but updated) Ubuntu installation with Jython 2.5.2. I tested on a Linux VM running on Virtualbox 4.0.8. The consistent result for me was that the current web2py releases don't work on Jython. For example with R-1.90.2 and later the welcome app shows immediately (on first access) a ticket. Root cause has something to do with the sqlite driver ('com.ziclix.python.sql.PyConnection' object has no attribute 'create_function'). Even older versions seem to raise exceptions with tracebacks shown in the Jython console, hinting to 'rocket' and 'multithreading'. Details available upon request. The most 'recent' version of web2py that seems to be running with Jython 2.5.x seems to be 1.85.2 (hg commit #907). Even #918 seems to be working fine. Later versions don't. I diffed the sources, but somehow couldn't make sense of it. So that is where I am standing now. What I am doing wrong? I seem to be quite alone with my experiences since Google didn't provide pointers to fellow sufferers. To reiterate my question: Has anyone running a reasonably current version of web2py running on Jython 2.5.x? Regards, Richard
[web2py] Re: I created a little app to be able to share some files over the net without authentication
Update of the app: Changelog 110623 - generating MD5Sum with hashlib for uploaded files - little design change
Re: [web2py] Running web2py on Jython
2011/6/23 Richard richb...@gmail.com Hi, has anyone running a reasonably current version of web2py running on Jython 2.5.x? I need help with this. Hello Richard, Yes, I did a try but I didn't wanted to go very far with that. I was just curious about giving it a try. I had a problem with the database stuff I remember. I think this is the same issue that you have. web2py is no longer working with Python 2.4. Python 2.4 is old stuff now. Here I wrote about using SQLite with Jython. I think this can help: http://pierrethibault.posterous.com/?tag=jythonpage=2 -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
[web2py] Re: Legacy database adaptation in web2py, best way?
On Thursday, June 23, 2011 7:15:34 AM UTC-4, DanielB wrote: Another problem I had with CRUD forms in my case is that I really want to make the if .accepts() call myself so that I can then call the business layer with the database related stuff, but it seems the CRUD forms do this call automatically? In the case of SQLFORM.factory forms I can make the .accepts myself If you want to do your own if form.accepts() calls but also want it to handle the database stuff, you can use SQLFORM instead of Crud (see http://web2py.com/book/default/chapter/07#SQLFORM). You can also use the various Crud _onvalidation settings to specify actions to take between validation and acceptance (see http://web2py.com/book/default/chapter/07#Settings). Anthony
[web2py] How do I apply placeholder text to web2py forms?
I'm using custom forms in my views using this format: {{=form.custom.widget.first_name}} I'd like to use HTML's placeholder attribute to input tags: e.g., input type=text placeholder=first name / Today: what are the ways to enable this? Obviously happy to drop the {{=form.custom.widget.first_name}} format and use something else. Tomorrow: might it be a good idea to add placeholder attribute to db.Field() in a similar fashion to how 'label' has already been added?
[web2py] response.write to transport index of the proper tabs from controller to the jQuery UI tabs plugin
Hello, In order to get the proper tabs to render the validators message in case they have been triggered I would like to know if I use response.write(TABS INDEX) could be a option?? Here my set up : *VIEW* style type=text/css title=currentStyle @import {{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/themes/base/jquery.ui.all.css')}}; /style script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/js/jquery-1.4.4.min.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/ui/jquery.ui.core.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/ui/jquery.ui.widget.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/ui/jquery.ui.tabs.js')}}/script script $(function() { var $tabs = $( #tabs ).tabs(); $tabs.tabs('select', {{response.write()}}); return false; }); /script div class=demo br/ br/ br/ div id=tabs ul lia href=#tabs-1{{=T('folder').capitalize()}}/a/li lia href=#tabs-2{{=T('volume').capitalize()}}/a/li lia href=#tabs-3{{=T('tome').capitalize()}}/a/li lia href=#tabs-4{{=T('report').capitalize()}}/a/li /ul div id=tabs-1 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_fnaregistry',extension='load',ajax=False,ajax_trap=False,target='one')}} /div!-- tabs-1 -- div id=tabs-2 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_vregistry',extension='load',ajax=False,ajax_trap=False,target='two')}} /div!-- tabs-2 -- div id=tabs-3 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_tregistry',extension='load',ajax=False,ajax_trap=False,target='three')}} /div!-- tabs-3 -- div id=tabs-4 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_eregistry',extension='load',ajax=False,ajax_trap=False,target='four')}} /div!-- tabs-4 -- /div!-- tabs -- /div!-- End demo -- *CONTROLLER* def creation(): Empty function for make it works the jQuery tabs plugin for ref_* tables. a = None return dict(a=a) @auth.requires_login() def create_fvte(): table = request.args(0)#.replace('.load','') if auth.has_membership(auth.id_group('admin')): crud.settings.formstyle='divs' form = crud.create(db[table]) for i in range(0,len(form[0])): if len(form[0][i][2][0]) 0: form[0][i][0].append(SPAN((helpicon(), SPAN(form[0][i][2][0])),_class='tooltip')) del(form[0][i][2]) elif auth.has_membership(auth.id_group('technician')): crud.settings.formstyle='divs' form = crud.create(db[table]) for i in range(0,len(form[0])): if len(form[0][i][2][0]) 0: form[0][i][0].append(SPAN((helpicon(), SPAN(form[0][i][2][0])),_class='tooltip')) del(form[0][i][2]) elif auth.has_membership(auth.id_group('technician_c')): crud.settings.formstyle='divs' form = crud.create(db[table]) for i in range(0,len(form[0])): if len(form[0][i][2][0]) 0: form[0][i][0].append(SPAN((helpicon(), SPAN(form[0][i][2][0])),_class='tooltip')) del(form[0][i][2]) else: return dict(form=None) if form.accepts(request.vars, session): session.flash = T('form accepted') if table == 'ref_fnaregistry': redirect(URL(c='ref', f='creation#tabs-2')) elif table == 'ref_vregistry': redirect(URL(c='ref', f='creation#tabs-3')) elif table == 'ref_tregistry': redirect(URL(c='ref', f='creation#tabs-4')) #elif table == 'ref_eregistry': #redirect(URL(c='ref', f='creation#tabs-2')) elif form.errors: response.flash = T('form has errors') #if table == 'ref_fnaregistry': #redirect(URL(c='ref', f='creation#tabs-1')) #elif table == 'ref_vregistry': #redirect(URL(c='ref', f='creation#tabs-2')) if table == 'ref_tregistry': response.write(2) #redirect(URL(c='ref', f='creation#tabs-3')) #elif table == 'ref_eregistry': #redirect(URL(c='ref', f='creation#tabs-4')) else: response.flash = T('please fill out the form') return dict(form=form) I try to avoid ajax=True,ajax_trap=False option of LOAD() cause they seem to conflict with the official jQuery UI Tabs plugin (loading pretty slow, reload after submit with triggered validator even worse and try to load the entire site before loading only my proper form). I may not completly understand usage of component... Thanks to help. Richard
[web2py] Re: How do I apply placeholder text to web2py forms?
form.element(_id='...')['_placeholder']='...' On Jun 23, 9:24 am, Carl m...@carlroach.com wrote: I'm using custom forms in my views using this format: {{=form.custom.widget.first_name}} I'd like to use HTML's placeholder attribute to input tags: e.g., input type=text placeholder=first name / Today: what are the ways to enable this? Obviously happy to drop the {{=form.custom.widget.first_name}} format and use something else. Tomorrow: might it be a good idea to add placeholder attribute to db.Field() in a similar fashion to how 'label' has already been added?
[web2py] Re: Befuddled by SQLTABLE linkto
Hi Cliff, the id field is handled as a special case inside SQLTABLE and the linkto can only affect the _href portion of the anchor (A helper), not the visible part. But you can still do it: rows=db(...).select(...) t=SQLTABLE(rows) for n,row in enumerate(rows): t[1][n][0][0] = A('Edit',_href=URL(r=request,args=[n])) you can play with the values in row to customize it. t[1] if the table's body t[1][n] is the n-th row t[1][n][0] is the first TD on that row t[1][n][0][0] is the content (in this case the id value). On Jun 22, 2:49 pm, Cliff cjk...@gmail.com wrote: I'm not new to programming, but I am relatively new to Python and just starting my web2py journey. I have SQLTABLE working with one small exception. For the edit link, I would like to replace the record id with the word Edit. I have read the discussions in this group about using represent and other methods. Represent seems to be the simplest way to go, but I cannot get it to work. Could someone point me to a working example? From there I can probably figure it out. Thanks
[web2py] spawning response.flash in plugin_wiki page
is this possible? how would you implement a change to make it work? thanks
Re: [web2py] response.write to transport index of the proper tabs from controller to the jQuery UI tabs plugin
I don't think you want to call response.write in your controller -- it appends text to the response body, so you would be adding the text before the rest of the response body is rendered by the view. You also shouldn't need to call response.write from within the view, because you can just do {{=whatever_you_want_to_write}}. Instead, you should be able to just pass a variable to the view. In your controller, return dict(form=form, tab=tab), and in your view, {{=tab}}. Anthony On Thursday, June 23, 2011 10:36:39 AM UTC-4, Richard wrote: Hello, In order to get the proper tabs to render the validators message in case they have been triggered I would like to know if I use response.write(TABS INDEX) could be a option?? Here my set up : *VIEW* style type=text/css title=currentStyle @import {{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/themes/base/jquery.ui.all.css')}}; /style script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/js/jquery-1.4.4.min.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/ui/jquery.ui.core.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/ui/jquery.ui.widget.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/ui/jquery.ui.tabs.js')}}/script script $(function() { var $tabs = $( #tabs ).tabs(); $tabs.tabs('select', {{response.write()}}); return false; }); /script div class=demo br/ br/ br/ div id=tabs ul lia href=#tabs-1{{=T('folder').capitalize()}}/a/li lia href=#tabs-2{{=T('volume').capitalize()}}/a/li lia href=#tabs-3{{=T('tome').capitalize()}}/a/li lia href=#tabs-4{{=T('report').capitalize()}}/a/li /ul div id=tabs-1 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_fnaregistry',extension='load',ajax=False,ajax_trap=False,target='one')}} /div!-- tabs-1 -- div id=tabs-2 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_vregistry',extension='load',ajax=False,ajax_trap=False,target='two')}} /div!-- tabs-2 -- div id=tabs-3 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_tregistry',extension='load',ajax=False,ajax_trap=False,target='three')}} /div!-- tabs-3 -- div id=tabs-4 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_eregistry',extension='load',ajax=False,ajax_trap=False,target='four')}} /div!-- tabs-4 -- /div!-- tabs -- /div!-- End demo -- *CONTROLLER* def creation(): Empty function for make it works the jQuery tabs plugin for ref_* tables. a = None return dict(a=a) @auth.requires_login() def create_fvte(): table = request.args(0)#.replace('.load','') if auth.has_membership(auth.id_group('admin')): crud.settings.formstyle='divs' form = crud.create(db[table]) for i in range(0,len(form[0])): if len(form[0][i][2][0]) 0: form[0][i][0].append(SPAN((helpicon(), SPAN(form[0][i][2][0])),_class='tooltip')) del(form[0][i][2]) elif auth.has_membership(auth.id_group('technician')): crud.settings.formstyle='divs' form = crud.create(db[table]) for i in range(0,len(form[0])): if len(form[0][i][2][0]) 0: form[0][i][0].append(SPAN((helpicon(), SPAN(form[0][i][2][0])),_class='tooltip')) del(form[0][i][2]) elif auth.has_membership(auth.id_group('technician_c')): crud.settings.formstyle='divs' form = crud.create(db[table]) for i in range(0,len(form[0])): if len(form[0][i][2][0]) 0: form[0][i][0].append(SPAN((helpicon(), SPAN(form[0][i][2][0])),_class='tooltip')) del(form[0][i][2]) else: return dict(form=None) if form.accepts(request.vars, session): session.flash = T('form accepted') if table == 'ref_fnaregistry': redirect(URL(c='ref', f='creation#tabs-2')) elif table == 'ref_vregistry': redirect(URL(c='ref', f='creation#tabs-3')) elif table == 'ref_tregistry': redirect(URL(c='ref', f='creation#tabs-4')) #elif table == 'ref_eregistry': #redirect(URL(c='ref', f='creation#tabs-2')) elif form.errors: response.flash = T('form has errors') #if table == 'ref_fnaregistry': #redirect(URL(c='ref', f='creation#tabs-1')) #elif table == 'ref_vregistry': #redirect(URL(c='ref', f='creation#tabs-2')) if table == 'ref_tregistry': response.write(2) #redirect(URL(c='ref', f='creation#tabs-3')) #elif table ==
Re: [web2py] response.write to transport index of the proper tabs from controller to the jQuery UI tabs plugin
Hello Anthony, I can't use a var like you suggest since it popup in the component for noting... I am using session.MYVAR that seems to work... But I don't find the way to get session vars in jQuery I try like this : script $(function() { var $tabs = $( #tabs ).tabs(); var test1 = {{=session.test1}}; # OR like this : %{{=session.test1}}% and with and without quote or double quote... $tabs.tabs('select', test1); return false; }); /script If I can get my variable value in jQuery do you think it a go work around? Richard On Thu, Jun 23, 2011 at 11:09 AM, Anthony abasta...@gmail.com wrote: I don't think you want to call response.write in your controller -- it appends text to the response body, so you would be adding the text before the rest of the response body is rendered by the view. You also shouldn't need to call response.write from within the view, because you can just do {{=whatever_you_want_to_write}}. Instead, you should be able to just pass a variable to the view. In your controller, return dict(form=form, tab=tab), and in your view, {{=tab}}. Anthony On Thursday, June 23, 2011 10:36:39 AM UTC-4, Richard wrote: Hello, In order to get the proper tabs to render the validators message in case they have been triggered I would like to know if I use response.write(TABS INDEX) could be a option?? Here my set up : *VIEW* style type=text/css title=currentStyle @import {{=URL('static','plugin_**added/jquery-ui-1.8.9.custom/** development-bundle/themes/**base/jquery.ui.all.css')}}; /style script type=text/javascript charset=utf-8 src={{=URL('static','plugin_**added/jquery-ui-1.8.9.custom/** js/jquery-1.4.4.min.js')}}/**script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_**added/jquery-ui-1.8.9.custom/** development-bundle/ui/jquery.**ui.core.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_**added/jquery-ui-1.8.9.custom/** development-bundle/ui/jquery.**ui.widget.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_**added/jquery-ui-1.8.9.custom/** development-bundle/ui/jquery.**ui.tabs.js')}}/script script $(function() { var $tabs = $( #tabs ).tabs(); $tabs.tabs('select', {{response.write()}}); return false; }); /script div class=demo br/ br/ br/ div id=tabs ul lia href=#tabs-1{{=T('folder').**capitalize()}}/a/li lia href=#tabs-2{{=T('volume').**capitalize()}}/a/li lia href=#tabs-3{{=T('tome').**capitalize()}}/a/li lia href=#tabs-4{{=T('report').**capitalize()}}/a/li /ul div id=tabs-1 br/ {{=LOAD(c='ref',f='create_**fvte',args='ref_fnaregistry',** extension='load',ajax=False,**ajax_trap=False,target='one')}**} /div!-- tabs-1 -- div id=tabs-2 br/ {{=LOAD(c='ref',f='create_**fvte',args='ref_vregistry',** extension='load',ajax=False,**ajax_trap=False,target='two')}**} /div!-- tabs-2 -- div id=tabs-3 br/ {{=LOAD(c='ref',f='create_**fvte',args='ref_tregistry',** extension='load',ajax=False,**ajax_trap=False,target='three'**)}} /div!-- tabs-3 -- div id=tabs-4 br/ {{=LOAD(c='ref',f='create_**fvte',args='ref_eregistry',** extension='load',ajax=False,**ajax_trap=False,target='four')**}} /div!-- tabs-4 -- /div!-- tabs -- /div!-- End demo -- *CONTROLLER* def creation(): Empty function for make it works the jQuery tabs plugin for ref_* tables. a = None return dict(a=a) @auth.requires_login() def create_fvte(): table = request.args(0)#.replace('.**load','') if auth.has_membership(auth.id_**group('admin')): crud.settings.formstyle='divs' form = crud.create(db[table]) for i in range(0,len(form[0])): if len(form[0][i][2][0]) 0: form[0][i][0].append(SPAN((**helpicon(), SPAN(form[0][i][2][0])),_**class='tooltip')) del(form[0][i][2]) elif auth.has_membership(auth.id_**group('technician')): crud.settings.formstyle='divs' form = crud.create(db[table]) for i in range(0,len(form[0])): if len(form[0][i][2][0]) 0: form[0][i][0].append(SPAN((**helpicon(), SPAN(form[0][i][2][0])),_**class='tooltip')) del(form[0][i][2]) elif auth.has_membership(auth.id_**group('technician_c')): crud.settings.formstyle='divs' form = crud.create(db[table]) for i in range(0,len(form[0])): if len(form[0][i][2][0]) 0: form[0][i][0].append(SPAN((**helpicon(), SPAN(form[0][i][2][0])),_**class='tooltip')) del(form[0][i][2]) else: return dict(form=None) if form.accepts(request.vars, session): session.flash = T('form accepted') if table == 'ref_fnaregistry': redirect(URL(c='ref', f='creation#tabs-2')) elif
[web2py] Re: ekjaa
http://www.ekjaa.org/Ekjaa/about/team_Members On Jun 23, 9:03 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: How is behind it? http://www.ekjaa.org/ Really good job! massimo
[web2py] Re: How do I apply placeholder text to web2py forms?
A couple other methods: 1. In the controller or view: form.custom.widget.first_name.update(_placeholder=first name) or 2. Customize the db.yourtable.first_name widget: db.define_table('yourtable', Field('first_name', widget=lambda field,value: SQLFORM.widgets.string.widget(field, value, _placeholder='first name')), [rest of table definition]) or specify it after table definition via db.yourtable.first_name.widget=lambda... Method #2 will apply the change to all forms that include that field. There should probably be an easier/more straightforward way to do this, though. All the widgets take keyword arguments, but it doesn't look like there's an easy way to pass them in when the widgets are associated with db table fields. Anthony On Thursday, June 23, 2011 10:55:19 AM UTC-4, Massimo Di Pierro wrote: form.element(_id='...')['_placeholder']='...' On Jun 23, 9:24 am, Carl m@carlroach.com wrote: I'm using custom forms in my views using this format: {{=form.custom.widget.first_name}} I'd like to use HTML's placeholder attribute to input tags: e.g., input type=text placeholder=first name / Today: what are the ways to enable this? Obviously happy to drop the {{=form.custom.widget.first_name}} format and use something else. Tomorrow: might it be a good idea to add placeholder attribute to db.Field() in a similar fashion to how 'label' has already been added?
Re: [web2py] Re: How do I apply placeholder text to web2py forms?
thanks. feels right to have this data in the view but I can see the advantage of 'declare once' in the model. I agree Anthony, a solution could be baked into web2py as 'label' already has been. html5 is here and adoption is pretty good thanks in large part to webkit. On 23 June 2011 17:04, Anthony abasta...@gmail.com wrote: A couple other methods: 1. In the controller or view: form.custom.widget.first_name.update(_placeholder=first name) or 2. Customize the db.yourtable.first_name widget: db.define_table('yourtable', Field('first_name', widget=lambda field,value: SQLFORM.widgets.string.widget(field, value, _placeholder='first name')), [rest of table definition]) or specify it after table definition via db.yourtable.first_name.widget=lambda... Method #2 will apply the change to all forms that include that field. There should probably be an easier/more straightforward way to do this, though. All the widgets take keyword arguments, but it doesn't look like there's an easy way to pass them in when the widgets are associated with db table fields. Anthony On Thursday, June 23, 2011 10:55:19 AM UTC-4, Massimo Di Pierro wrote: form.element(_id='...')['_placeholder']='...' On Jun 23, 9:24 am, Carl m@carlroach.com wrote: I'm using custom forms in my views using this format: {{=form.custom.widget.first_name}} I'd like to use HTML's placeholder attribute to input tags: e.g., input type=text placeholder=first name / Today: what are the ways to enable this? Obviously happy to drop the {{=form.custom.widget.first_name}} format and use something else. Tomorrow: might it be a good idea to add placeholder attribute to db.Field() in a similar fashion to how 'label' has already been added?
Re: [web2py] response.write to transport index of the proper tabs from controller to the jQuery UI tabs plugin
On Thursday, June 23, 2011 11:19:16 AM UTC-4, Richard wrote: Hello Anthony, I can't use a var like you suggest since it popup in the component for noting... I'm not quite sure what you mean. Presumably you could add some logic to the controller or view. I am using session.MYVAR that seems to work... But I don't find the way to get session vars in jQuery I try like this : script $(function() { var $tabs = $( #tabs ).tabs(); var test1 = {{=session.test1}}; # OR like this : %{{=session.test1}}% and with and without quote or double quote... $tabs.tabs('select', test1); return false; }); /script Is the value of session.test1 getting inserted in your jQuery code properly? In that case, I suppose the issue is figuring out the jQuery code, not the web2py code. If session.test1 isn't getting inserted properly, what are you seeing there? Anthony
Re: [web2py] Re: How do I apply placeholder text to web2py forms?
On Thursday, June 23, 2011 12:19:06 PM UTC-4, Carl wrote: I agree Anthony, a solution could be baked into web2py as 'label' already has been. html5 is here and adoption is pretty good thanks in large part to webkit. Rather than a specific argument just for 'placeholder', it should be possible to specify any arbitrary input tag attribute (e.g., there are lots of them) -- the widgets accept such attributes via a **attributesargument, but doesn't look like there's an easy way to pass them in for widgets associated with db table fields. Anthony
Re: [web2py] Re: How do I apply placeholder text to web2py forms?
On Thursday, June 23, 2011 12:19:06 PM UTC-4, Carl wrote: I agree Anthony, a solution could be baked into web2py as 'label' already has been. html5 is here and adoption is pretty good thanks in large part to webkit. Rather than a specific argument just for 'placeholder', it should be possible to specify any arbitrary input tag attribute (there are lots of them) -- the widgets accept such attributes via a **attributes argument, but doesn't look like there's an easy way to pass them in for widgets associated with db table fields. Anthony
[web2py] Re: ekjaa
Is this a web2py site? Very nice. One comment: How Ekjaa works sliding tool moves a bit fast for me to read, and doesn't pause when my mouse is over it. Mike
[web2py] Re: ekjaa
They say here it is made with web2py: http://harshasmukherjee.wordpress.com/2011/06/23/fight-for-the-sight-of-our-website/ I checked it includes web2py_ajax code. It is really well done. On Jun 23, 11:38 am, mikech mp.ch...@gmail.com wrote: Is this a web2py site? Very nice. One comment: How Ekjaa works sliding tool moves a bit fast for me to read, and doesn't pause when my mouse is over it. Mike
[web2py] Re: ekjaa
On Thursday, June 23, 2011 12:38:29 PM UTC-4, mikech wrote: Is this a web2py site? Yes, you can tell if you look at the meta tags in the html head. The http response also includes x-powered-by=web2py.
Re: [web2py] response.write to transport index of the proper tabs from controller to the jQuery UI tabs plugin
Ok I see, I am getting '0' for example... I need to get rid of ''... Thanks... Richard On Thu, Jun 23, 2011 at 12:21 PM, Anthony abasta...@gmail.com wrote: On Thursday, June 23, 2011 11:19:16 AM UTC-4, Richard wrote: Hello Anthony, I can't use a var like you suggest since it popup in the component for noting... I'm not quite sure what you mean. Presumably you could add some logic to the controller or view. I am using session.MYVAR that seems to work... But I don't find the way to get session vars in jQuery I try like this : script $(function() { var $tabs = $( #tabs ).tabs(); var test1 = {{=session.test1}}; # OR like this : %{{=session.test1}}% and with and without quote or double quote... $tabs.tabs('select', test1); return false; }); /script Is the value of session.test1 getting inserted in your jQuery code properly? In that case, I suppose the issue is figuring out the jQuery code, not the web2py code. If session.test1 isn't getting inserted properly, what are you seeing there? Anthony
Re: [web2py] Re: How do I apply placeholder text to web2py forms?
gotcha. something more open-ended. On 23 June 2011 17:29, Anthony abasta...@gmail.com wrote: On Thursday, June 23, 2011 12:19:06 PM UTC-4, Carl wrote: I agree Anthony, a solution could be baked into web2py as 'label' already has been. html5 is here and adoption is pretty good thanks in large part to webkit. Rather than a specific argument just for 'placeholder', it should be possible to specify any arbitrary input tag attribute (there are lots of them) -- the widgets accept such attributes via a **attributes argument, but doesn't look like there's an easy way to pass them in for widgets associated with db table fields. Anthony
[web2py] Re: spawning response.flash in plugin_wiki page
can you explain more? On Jun 23, 10:03 am, blackthorne francisco@gmail.com wrote: is this possible? how would you implement a change to make it work? thanks
[web2py] startSSL: it was nice while it lasted
http://news.netcraft.com/archives/2011/06/22/startssl-suspends-services-after-security-breach.html
[web2py] Apache Subdomain Configuration
This is the first time I have really tried to deploy web2py to a production server, so I'm going to need some help. What I want to do is run my web2py app through Apache using a subdomain. Right now, I've got the server configured as a LAMP server using the default Ubuntu configuration because there are a couple of PHP applications running on the server as well. So if I want my web2py app to run from myapp.domain.com, what would my Apache site config file look like, and would I have do anything with routes.py? Thanks in advance for helping with this. I'm a developer, not a server admin :)
Re: [web2py] Apache Subdomain Configuration
Download and uncomprss (or just install ) the python-web2py package available in Debian and Ubuntu repositories, and take a look to the README.Debian file available at /usr/share/doc/python-web2py. There is a howto explaining exactly how to do it in Debian distribution and its derivatives. Regards. José L. 2011/6/23 Ross Peoples ross.peop...@gmail.com: This is the first time I have really tried to deploy web2py to a production server, so I'm going to need some help. What I want to do is run my web2py app through Apache using a subdomain. Right now, I've got the server configured as a LAMP server using the default Ubuntu configuration because there are a couple of PHP applications running on the server as well. So if I want my web2py app to run from myapp.domain.com, what would my Apache site config file look like, and would I have do anything with routes.py? Thanks in advance for helping with this. I'm a developer, not a server admin :)
Re: [web2py] Apache Subdomain Configuration
I copied the web2py folder over from the trunk, since that's the version I developed the app from. I cannot find the file you describe in the trunk version of web2py. A lot of the config files I see around the web involve putting web2py at the root of the server. What I wanted to do (and I don't know if it's possible), is to have an apache config file for each app that I want to expose through Apache. That way I can ensure that each app gets its own subdomain, and that I don't get redundant URL's like myapp.domain.com/myapp/default/index.
[web2py] Re: Running web2py on Jython
Hi Pierre, thanks for replying. I remember that I already stumbled upon the blog page you mention before I posted my question on this list. I admit that I didn't read it in depth back then. But I took as a good sign that you wrote in your final line: Everything works fine and web2py runs with Jython. :-) I did not read it in detail because your description was not quite matching with my prospective setup. My Linux distribution won't be quite the same, and as a restricted user I will certainly be in no position to install packages. In addition to that I didn't understand some details of your instructions. Why would it be necessary to build the SQLite native library? It is true that Jython comes *without* a sqlite3 module (import sqlite3 fails on Jython). But that's why the zxJDBC driver has to be put into the classpath. When it is loaded it will be announced in the web2py startup with the line Database drivers available: pymysql, zxJDBC. IMHO that should suffice. I am certainly missing parts of the whole picture here, but if building a SQLite native library is a required step for setting up web2py on Jython, it certainly should be put into the Official web2py Book. So far there is no mention of such a requirement now. On the contrary, I believe the native sqlite library is not needed. Most convincing for me: When I start a clean source code install of web2py R-1.85.2 unter Jython/Linux and access the welcome app via browser, then a sqlite database automagically appears in the filesystemin a newly created folder 'databases'. Via admin app the database can be edited. For example I added a new user and then verified that the new entry was written to the database file. As an addititional note, when I verified this behaviour with R-1.85.2, I noticed a bug (attention Massimo). Unter Jython the name of the database, as declared in models/db.py, gets 'shortened'. With the standard declaration db = DAL('sqlite://storage.sqlite') the name of the file in folder 'databases' is 'ge.sqlite'. If I change the name in the declaration to 'richardstorage.sqlite' the real database file is named 'rdstorage.sqlite'. Somehow the first five chars get dropped unter Jython 2.5.2, verified unter Windows XP and Linux (Ubuntu derivative). No such error running this version of web2py under Python 2.6. I can't tell if this error still exist in hg tip since other errors stop me before that point :-( Regards, Richard
[web2py] Shell: Foreground Color
Is it possible to change the foreground color in the web2py Shell? It is something like orange. Orange on a white background is very hard to read . Martin
[web2py] Custom Widget Help.
I need help trying to create a custom widget; I want to create a phone-number widget I want it to only accept text in (800) 555-1212 I am not sure how to do this. Any ideas would be greatly appreciated.
[web2py] Concurrent connections and scalability on the cloud...
I am thinking of developing this for scalability on the cloud. What features do we currently have for this issue? What would be the best approach to handling concurrent requests? In other words, I want to scale on the cloud base on instances of web2py running off of the same data. I think this is something important when wanting to make a powerful deployment method for web2py. Best regards, Jason Brower
[web2py] Re: Befuddled by SQLTABLE linkto
That is sweet! Please point me to the documentation. Is it the docstring in the code? On Jun 23, 10:58 am, DenesL denes1...@yahoo.ca wrote: Hi Cliff, the id field is handled as a special case inside SQLTABLE and the linkto can only affect the _href portion of the anchor (A helper), not the visible part. But you can still do it: rows=db(...).select(...) t=SQLTABLE(rows) for n,row in enumerate(rows): t[1][n][0][0] = A('Edit',_href=URL(r=request,args=[n])) you can play with the values in row to customize it. t[1] if the table's body t[1][n] is the n-th row t[1][n][0] is the first TD on that row t[1][n][0][0] is the content (in this case the id value). On Jun 22, 2:49 pm, Cliff cjk...@gmail.com wrote: I'm not new to programming, but I am relatively new to Python and just starting my web2py journey. I have SQLTABLE working with one small exception. For the edit link, I would like to replace the record id with the word Edit. I have read the discussions in this group about using represent and other methods. Represent seems to be the simplest way to go, but I cannot get it to work. Could someone point me to a working example? From there I can probably figure it out. Thanks
[web2py] Re: Shell: Foreground Color
On Thursday, June 23, 2011 3:47:14 PM UTC-4, mweissen wrote: Is it possible to change the foreground color in the web2py Shell? It is something like orange. Orange on a white background is very hard to read . In the /* Shell */ section near the bottom of /applications/admin/static/css/styles.css, there are several occurrences of #e8953c -- I think that's the color you want to change. Anthony
Re: [web2py] Apache Subdomain Configuration
The file is not in web2py sources but in the Debian package . There is not problem in doing what you want El 23/06/2011 21:23, Ross Peoples ross.peop...@gmail.com escribió:
[web2py] Re: Befuddled by SQLTABLE linkto
On Thursday, June 23, 2011 4:15:59 PM UTC-4, Cliff wrote: That is sweet! Please point me to the documentation. Is it the docstring in the code? SQLTABLE inherits from TABLE, which is a web2py html helper object, so the usual server-side DOM stuff applies -- see http://web2py.com/book/default/chapter/05#Server-side-DOM-and-Parsing. I'm not sure if there is specific documentation about the DOM structure of the SQLTABLE object, so you may need to play around with it to figure it out (once you see the table serialized into HTML, you should have an idea of what the server-side object structure is). Anthony
[web2py] Re: Running web2py on Jython
Hi Massimo, this is my setup: - latest stable web2py version R-1.96.4 (hg commit #2032), clean checkout from repo - Jython 2.5.2 - set CLASSPATH=\path\to\jar\sqlitejdbc-v056.jar;%CLASSPATH% - jython web2py.py -a pwd --nogui -p80 -f \path\to\web2py-src-dir This is the console output: No handlers could be found for logger web2py.dal New installation: unable to create welcome.w2p fileweb2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.96.4 (2011-06-07 15:03:19) Database drivers available: pymysql, zxJDBC Starting hardcron... WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking please visit: http://127.0.0.1:80 use kill -SIGTERM 2808 to shutdown the web2py server WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking ... When accessing the welcome app via browser, I get this: Internal error Ticket issued: unrecoverable ... and this shows up in the console: ERROR:web2py:Traceback (most recent call last): File c:\_work\_in\web2py\gluon\restricted.py, line 192, in restricted exec ccode in environment File c:\_work\_in\web2py\applications\welcome\models/db.py, line 17, in module db = DAL('sqlite://storage.sqlite') # if not, use SQLite or other DB File c:\_work\_in\web2py\gluon\dal.py, line 3901, in __init__ raise RuntimeError, Failure to connect, tried %d times:\n%s % (attempts, error) RuntimeError: Failure to connect, tried 5 times: 'com.ziclix.python.sql.PyConnection' object has no attribute 'create_function' I doesn't matter whether the OS is Linux or Windows XP. It does matter whether it is Jython or Python, though. IMO the following three lines from the startup console output require attention: - No handlers could be found for logger web2py.dal - New installation: unable to create welcome.w2p fileweb2py Web Framework - WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking I've debugged a little bit into the origins of the second line. The root cause is still clear as mud to me, but I could give some hints. Regards, Richard
[web2py] response.files - not properly formatted html.
I think that when you add css files via response.files the output should include a '/' rather that '' xhtml requires all tags to be closed; while other doctypes are less strict I think its good practice to close all tags. Anyone disagree?
[web2py] Re: response.files - not properly formatted html.
Are you using the current version of web2py? The code that generates the link tag for css files appears to close the tag with a '/', as you suggest. Anthony On Thursday, June 23, 2011 4:49:47 PM UTC-4, David J wrote: I think that when you add css files via response.files the output should include a '/' rather that '' xhtml requires all tags to be closed; while other doctypes are less strict I think its good practice to close all tags. Anyone disagree?
Re: [web2py] Re: response.files - not properly formatted html.
Strange I am running trunk, but I think the version I checked was 1.93 perhaps. Let me see when that was added. Thanks for the update I didnt notice that. On 6/23/11 5:14 PM, Anthony wrote: Are you using the current version of web2py? The code that generates the link tag for css files appears to close the tag with a '/', as you suggest. Anthony On Thursday, June 23, 2011 4:49:47 PM UTC-4, David J wrote: I think that when you add css files via response.files the output should include a '/' rather that '' xhtml requires all tags to be closed; while other doctypes are less strict I think its good practice to close all tags. Anyone disagree?
[web2py] Re: Suggested functionality extention for SQLTABLE
This patch was applied?. I'm interested in this function.
[web2py] get attr value from TAG.element
Hi web2pyers: the TAG helper is very useful, but, it's any way to get the 'value' of the attribute from an element? Something like: element attr='value' / in that scenario, it is possible to get 'value' using just the TAG helper? I would appreciate your suggestions. Thank you in advance
Re: [web2py] Re: response.files - not properly formatted html.
Hmm, on Google Code, looks like the '/' has been there at least since Dec 2009 (v. 1.77) -- it doesn't go back any further. On Thursday, June 23, 2011 5:25:22 PM UTC-4, David J wrote: Strange I am running trunk, but I think the version I checked was 1.93 perhaps. Let me see when that was added. Thanks for the update I didnt notice that. On 6/23/11 5:14 PM, Anthony wrote: Are you using the current version of web2py? The code that generates the link tag for css files appears to close the tag with a '/', as you suggest. Anthony On Thursday, June 23, 2011 4:49:47 PM UTC-4, David J wrote: I think that when you add css files via response.files the output should include a '/' rather that '' xhtml requires all tags to be closed; while other doctypes are less strict I think its good practice to close all tags. Anyone disagree?
[web2py] Re: get attr value from TAG.element
mytag=TAG.element('xyz', _attr='value') print mytag.attributes['_attr'] value print mytag.components[0] xyz Anthony On Thursday, June 23, 2011 5:50:06 PM UTC-4, w2padawan wrote: Hi web2pyers: the TAG helper is very useful, but, it's any way to get the 'value' of the attribute from an element? Something like: element attr='value' / in that scenario, it is possible to get 'value' using just the TAG helper? I would appreciate your suggestions. Thank you in advance
[web2py] Re: get attr value from TAG.element
Note, the same thing works for any HTML helper, not just the TAG helper. On Thursday, June 23, 2011 6:21:37 PM UTC-4, Anthony wrote: mytag=TAG.element('xyz', _attr='value') print mytag.attributes['_attr'] value print mytag.components[0] xyz Anthony On Thursday, June 23, 2011 5:50:06 PM UTC-4, w2padawan wrote: Hi web2pyers: the TAG helper is very useful, but, it's any way to get the 'value' of the attribute from an element? Something like: element attr='value' / in that scenario, it is possible to get 'value' using just the TAG helper? I would appreciate your suggestions. Thank you in advance
[web2py] Off topic : Extintion Level Event on September ?
what do you think of this? http://ssd.jpl.nasa.gov/sbdb.cgi?sstr=elenin;orb=1;cov=0;log=0;cad=0#orb
[web2py] Re: spawning response.flash in plugin_wiki page
the possibility of loading a custom response.flash in a plugin_wiki page so that plugin_wiki users can also define this flash message for a page if they want to. On Jun 23, 5:43 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: can you explain more? On Jun 23, 10:03 am, blackthorne francisco@gmail.com wrote: is this possible? how would you implement a change to make it work? thanks
[web2py] changes in 1.96.1 1.96.4
Hi Thanks all for the nice features in 1.96. Where can I find more information about these changes? 1.96.1 - from gluon import * imports in every python module a web2py environment... Is this expected to have any significant performance degredation? 1.96.1 - No more need for local_import local_import has the reload=True feature. How does this work now? 1.96.4 - better support for id fields not called id Are we now able to define any existing integer fields as id? How would I use this? br / jonas
[web2py] Re: get attr value from TAG.element
Actually, even easier, you can just do mytag['_attr'] and mytag[0]. On Thursday, June 23, 2011 6:21:37 PM UTC-4, Anthony wrote: mytag=TAG.element('xyz', _attr='value') print mytag.attributes['_attr'] value print mytag.components[0] xyz Anthony On Thursday, June 23, 2011 5:50:06 PM UTC-4, w2padawan wrote: Hi web2pyers: the TAG helper is very useful, but, it's any way to get the 'value' of the attribute from an element? Something like: element attr='value' / in that scenario, it is possible to get 'value' using just the TAG helper? I would appreciate your suggestions. Thank you in advance
[web2py] Re: Running web2py on Jython
At startup do you get: zxJDBC support is experimental or no zxJDBC driver or None. Did you install the zxJDBC sqlite driver? It does not come with Jython. On Jun 23, 3:41 pm, Richard richb...@gmail.com wrote: Hi Massimo, this is my setup: - latest stable web2py version R-1.96.4 (hg commit #2032), clean checkout from repo - Jython 2.5.2 - set CLASSPATH=\path\to\jar\sqlitejdbc-v056.jar;%CLASSPATH% - jython web2py.py -a pwd --nogui -p80 -f \path\to\web2py-src-dir This is the console output: No handlers could be found for logger web2py.dal New installation: unable to create welcome.w2p fileweb2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.96.4 (2011-06-07 15:03:19) Database drivers available: pymysql, zxJDBC Starting hardcron... WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking please visit: http://127.0.0.1:80 use kill -SIGTERM 2808 to shutdown the web2py server WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking ... When accessing the welcome app via browser, I get this: Internal error Ticket issued: unrecoverable ... and this shows up in the console: ERROR:web2py:Traceback (most recent call last): File c:\_work\_in\web2py\gluon\restricted.py, line 192, in restricted exec ccode in environment File c:\_work\_in\web2py\applications\welcome\models/db.py, line 17, in module db = DAL('sqlite://storage.sqlite') # if not, use SQLite or other DB File c:\_work\_in\web2py\gluon\dal.py, line 3901, in __init__ raise RuntimeError, Failure to connect, tried %d times:\n%s % (attempts, error) RuntimeError: Failure to connect, tried 5 times: 'com.ziclix.python.sql.PyConnection' object has no attribute 'create_function' I doesn't matter whether the OS is Linux or Windows XP. It does matter whether it is Jython or Python, though. IMO the following three lines from the startup console output require attention: - No handlers could be found for logger web2py.dal - New installation: unable to create welcome.w2p fileweb2py Web Framework - WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking I've debugged a little bit into the origins of the second line. The root cause is still clear as mud to me, but I could give some hints. Regards, Richard
[web2py] Re: Concurrent connections and scalability on the cloud...
I just saw a prezo on Now today: http://nowjs.com/
Re: [web2py] Off topic : Extintion Level Event on September ?
interesting, but Idon't see that hit the earth in the animation. 2011/6/23 António Ramos ramstei...@gmail.com what do you think of this? http://ssd.jpl.nasa.gov/sbdb.cgi?sstr=elenin;orb=1;cov=0;log=0;cad=0#orb -- http://martin.tecnodoc.com.ar
Re: [web2py] changes in 1.96.1 1.96.4
1.96.1 - from gluon import * imports in every python module a web2py environment... Is this expected to have any significant performance degredation? I dont think so, 1.96.1 - No more need for local_import local_import has the reload=True feature. How does this work now? from gluon.custom_import import track_changes track_changes() 2011/6/23 Jonas Rundberg jo...@rundberg.com Hi Thanks all for the nice features in 1.96. Where can I find more information about these changes? 1.96.1 - from gluon import * imports in every python module a web2py environment... Is this expected to have any significant performance degredation? 1.96.1 - No more need for local_import local_import has the reload=True feature. How does this work now? 1.96.4 - better support for id fields not called id Are we now able to define any existing integer fields as id? How would I use this? br / jonas -- http://martin.tecnodoc.com.ar
[web2py] generic.html not beautifying dict
Why doesn't generic.html beautify when len(vars)==1? When I send in one record, I'd like it to display beautified. {{if len(response._vars)==1:}} {{=response._vars.values()[0]}} {{elif len(response._vars)1:}} {{=BEAUTIFY(response._vars)}} {{pass}}
[web2py] Re: generic.html not beautifying dict
I do not oppose to the change. Anybody else pros or cons? Massimo On Jun 23, 7:10 pm, pbreit pbreitenb...@gmail.com wrote: Why doesn't generic.html beautify when len(vars)==1? When I send in one record, I'd like it to display beautified. {{if len(response._vars)==1:}} {{=response._vars.values()[0]}} {{elif len(response._vars)1:}} {{=BEAUTIFY(response._vars)}} {{pass}}
[web2py] Re: generic.html not beautifying dict
I assume it was designed not to call BEAUTIFY with a single item so you could use generic.html to display a real page (i.e., not just for development). BEAUTIFY isn't ideal for that because it displays the key for each item in _vars to the left of the rendered objects. Maybe it could test to see if the object is a string or has an xml() method, and not call BEAUTIFY in that case. And/or call BEAUTIFY with response._vars.values(), so the _vars key won't get displayed (maybe even do this when multiple items are in response._vars). Maybe there are other options... Anthony On Thursday, June 23, 2011 9:05:00 PM UTC-4, Massimo Di Pierro wrote: I do not oppose to the change. Anybody else pros or cons? Massimo On Jun 23, 7:10 pm, pbreit pbreit...@gmail.com wrote: Why doesn't generic.html beautify when len(vars)==1? When I send in one record, I'd like it to display beautified. {{if len(response._vars)==1:}} {{=response._vars.values()[0]}} {{elif len(response._vars)1:}} {{=BEAUTIFY(response._vars)}} {{pass}}
[web2py] 2 Client/Player Game
I wrote a game using Pyjamas that I have on a web2py server. I'm currently trying to set it up so 2 players can play against each other from different computers/clients. Each player has an account they use to access the game, so there is user info the server can use if that's needed. Is it possible to do this with web2py and Pyjamas/javascript? Do I need any special services?
Re: [web2py] Re: Suggested functionality extention for SQLTABLE
I am also interested, would help me on the new version of PowerTable plugin. -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] On Thu, Jun 23, 2011 at 6:48 PM, Martin.Mulone mulone.mar...@gmail.comwrote: This patch was applied?. I'm interested in this function.
[web2py] Re: Suggested functionality extention for SQLTABLE
Me too. I want it.