[web2py] Re: GAE issue with !=
it works, and the != test that i tried also works. i wonder if it has to do with how i tested the constuction? my test was of a dynamic query built like: def build_query(field, op, value): Builds the web2py query object for a given field if op == 'equals': return field == value elif op == 'not equal': return field != value elif op == 'greater than': return field value elif op == 'less than': return field value elif op == 'starts with': return field.like(value+'%') elif op == 'ends with': return field.like('%'+value) elif op == 'contains': return field.like('%'+value+'%') now this is still just a local environment. i can deploy and test it on real GAE tomorrow. is there another particular test you would like me to try? thanks for fixing the other issues! christian
[web2py] Re: new google groups
In Opera 10.61: This browser is not supported. :(
[web2py] Re: How to create a module
It should be: modules/checkrole.py and: role=local_import('checkrole')
[web2py] Re: How to create a module
Thanks a ton...Its working :-) On Dec 9, 2:43 pm, pbreit pbreitenb...@gmail.com wrote: It should be: modules/checkrole.py and: role=local_import('checkrole')
Re: [web2py] Re: Interesting fights
It all depends on how many stages you manage to clear. ;) On Thu, Dec 9, 2010 at 7:29 AM, Bruno Rocha rochacbr...@gmail.com wrote: This remembers me the 3 stages of truth: All truth passes through three stages. First, it is ridiculed. Second, it is violently opposed. Third, it is accepted as being self-evident. Arthur Schopenhauer German philosopher (1788 - 1860) 2010/12/9 Anthony abasta...@gmail.com To put things in perspective, even this is getting some downvotes on reddit: http://www.reddit.com/r/Python/comments/eihkb/web2py_application_exhibition_version_20/ On Monday, December 6, 2010 8:27:41 PM UTC-5, Anthony wrote: On Dec 6, 7:51 pm, Branko Vukelic bg.b...@gmail.com wrote: Oooh, someone's going legal: For example suing pyjamas. -- Massimo For the record, Redditors, just a typo (suing -- using) -- no one is suing pyjamas. ;) Really? :D Well, I did wink. Actually, there are a few questionable characters on reddit who actively disparage/downvote web2py and Massimo and will happily take things like this out of context. -- Bruno Rocha http://about.me/rochacbruno/bio -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] web2py and yserial
I came across yserial and thought it would make a good sidekick for web2py! http://yserial.sourceforge.net ( y_serial :: warehouse compressed Python objects with SQLite ) My idea is to capture into a temporary table ( SQLFactory??) a set of data records each containing several options (eg a test of multiple choice questions). These are transposed into a python object(dictionary/list of lists??) and serialised into another sqlite db managed by yserial thus all web2py stores in a relevant field is the yserial reference. When this 'Test' composed of sets of options is selected, it reconstructs from the py object back into a temporary table for presentation to the user by web2py as usual ( or written to XML or JSON) My Logic :-/ preliminary testing yserial seems to co-exist happily in web2py similar to a pickling system but more flexible this plan eliminates some complex joins in web2py a reference in one row in web2py table can access a complete 'Test' My question Is there any advance on the temp table thread ( maybe in new DAL ?) Following up some old threads on temporary tables but I noticed more recent posts with similar needs/ideas can the above idea be more easily done in pure web2py? any suggestions? (maybe it can be of use to others) web2py is great - this group rocks
Re: [web2py] routes question
so I am asking again, as I don't have an answer, is it broken the old functionality or am I missing something?
[web2py] Re: convert python list to javascript array
Thank u very much =) On Dec 2, 11:45 pm, Josh Jaques jjaq...@seccuris.com wrote: Sounds like you're looking for response.json def test(): coords = ((1,2), (3,4), (5,6)) return response.json(coords=coords) Returns a javascript array formatted like: [[1, 2], [3, 4], [5, 6]] Or you can use response.json(dict(coords=coords)) to get a javascript object: {coords: [[1, 2], [3, 4], [5, 6]]} Note that you also don't have to immediately return the result of response.json, you can save it and output it in the view, inside a script tag, for example -Original Message- From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf Of 1904 Sent: Thursday, December 02, 2010 9:12 AM To: web2py-users Subject: [web2py] convert python list to javascript array Hello, i m totally new to web2py and im trying to use it with google maps api and javascript to build a map. So I got some longtiudes and latidues from a MySQL database. The problem is that I cant convert the Python list [with the lat and lng values] from the database into a javascript array which is needed. I build the list with the values in a controller file and return it to the view file. Python list: coordinates((1,2) , (3,4) , (5,6)) I tried it on this way: while(j=len()) //len = length of coordinates { var coor[{{=x}}][0] = {{=coordinates[y][0]}}; var coor[{{=x}}][1] = {{=coordinates[y][1]}}; j++; } but it is not possible because Y doesnt raise... So the question is how can I use JS variables and/or Python variables together? Thanks for help This communication, including any attachments, does not necessarily represent official policy of Seccuris Inc. Please seehttp://www.seccuris.com/Contact-PrivacyPolicy.htm for further details about Seccuris Inc.'s Privacy Policy. If you have received this communication in error, please notify Seccuris Inc. at i...@seccuris.com or at 1-866-644-8442.
[web2py] Re: routes question
('/(.*)', '/myapp/$1'), This is not a valid Python regular expression. You are mixing here the RE syntax with the simplified web2py tags. Correct RE would be: (/(.*), r/myapp/\1) Correct web2py tags: (/$tag, /myapp/$tag)
[web2py] Re: Basic models question
On Monday, December 6, 2010 12:51:25 PM UTC-5, Anthony wrote: Also, the model files are executed in alphabetical order, so model_1.py will have access to things defined in model_0.py, but not the other way around. Note, I may have missed it, but I don't think this is actually mentioned in the book anywhere -- might be useful to include.
[web2py] Re: routes conundrum
I don't think we can help you with this until you: 1) explain what is the difference in behaviour 2) post your /web2py/routes.py (preferably at http://python.pastebin.com/)
[web2py] local_import() nested inside local_import() not working
I am trying to import a module 'pychimp' from another module 'inbite' using local_import(). Both modules are in my modules directory. When I nest a local_import() inside another local_import() I get an error: c...@inbite.py: local_import('pychimp', reload=True) inbite = local_import('inbite', reload=True) Traceback (most recent call last): File console, line 1, in module File gluon/compileapp.py, line 241, in lambda File gluon/compileapp.py, line 176, in local_import_aux File applications\inbite\modules\inbite.py, line 3, in module NameError: name 'local_import' is not defined So I try importing the module that has local_import: c...@inbite.py: import gluon.compileapp gluon.compileapp.local_import('pychimp', reload=True) inbite = local_import('inbite', reload=True) Traceback (most recent call last): File console, line 1, in module File gluon/compileapp.py, line 241, in lambda File gluon/compileapp.py, line 176, in local_import_aux File applications\inbite\modules\inbite.py, line 4, in module AttributeError: 'module' object has no attribute 'local_import' Unnested, it works fine: pc = local_import('pychimp', reload=True) Also if I import like below it also seems to work fine, but I read it is better to import modules from the app modules directory using local_import(): import applications.inbite.modules.pychimp as pychimp Can anyone tell me how to do nested local_import()? Thanks, John
[web2py] Re: local_import() nested inside local_import() not working
models and controllers are not modules. models and controllers can import modules using import module if module is in sys.path and using local_import(module) if module is not in sys.path but is in /applications/app/modules. modules are - of course - modules so thy can import other modules using import module. They should not and cannot use local_import because that's only for models and controllers. Massimo On Dec 9, 8:47 am, John-Kim Murphy left...@gmail.com wrote: I am trying to import a module 'pychimp' from another module 'inbite' using local_import(). Both modules are in my modules directory. When I nest a local_import() inside another local_import() I get an error: c...@inbite.py: local_import('pychimp', reload=True) inbite = local_import('inbite', reload=True) Traceback (most recent call last): File console, line 1, in module File gluon/compileapp.py, line 241, in lambda File gluon/compileapp.py, line 176, in local_import_aux File applications\inbite\modules\inbite.py, line 3, in module NameError: name 'local_import' is not defined So I try importing the module that has local_import: c...@inbite.py: import gluon.compileapp gluon.compileapp.local_import('pychimp', reload=True) inbite = local_import('inbite', reload=True) Traceback (most recent call last): File console, line 1, in module File gluon/compileapp.py, line 241, in lambda File gluon/compileapp.py, line 176, in local_import_aux File applications\inbite\modules\inbite.py, line 4, in module AttributeError: 'module' object has no attribute 'local_import' Unnested, it works fine: pc = local_import('pychimp', reload=True) Also if I import like below it also seems to work fine, but I read it is better to import modules from the app modules directory using local_import(): import applications.inbite.modules.pychimp as pychimp Can anyone tell me how to do nested local_import()? Thanks, John
[web2py] Re: Off Topic: HTML5 webapps with Google Closure, Clojure and NoSQL db's
We use web2py and Google Closure for a large application. The closure library itself has a rather steep learning curve compared to jquery and dojo. It works very similar to dojo. When we started using Closure July 2010 there was very little documenation to be found online. It is improving but I still recomend. http://oreilly.com/catalog/0636920001416 It really is worth it for a large application. Another recommendation is to us plover - http://plovr.com/ it is a build tool that prevents you from haveing to learn their dependency system. On Dec 7, 5:02 pm, Richard richar...@gmail.com wrote: very interesting. Does anyone have experience with Google Closure? On Dec 7, 10:00 pm, Tom Atkins minkto...@gmail.com wrote: Interesting way of doing things for web apps: http://www.hackers-with-attitude.com/2010/10/using-clojure-nosql-data... May have some relevance to web2py with the new support for NoSQL db's - I like the idea of auto data sync between client (local storage API) and server (NoSQL key value store) with 'versioning' of data to avoid update conflicts. Maybe possible to make this an option in web2py for the future? Google Closure javascript stuff looks interesting too...
[web2py] Can any help me with crud.create?
Hi, in web2py 1.89.5 works but in trunk no This is in the controller def realizar_venta(): return dict(form=crud.create(db.notas, next=URL(r=request, f='leer_ventas'), onvalidation=procesing_nota, onaccept=procesing_taller)) This is in the model db.define_table(notas, audit, Field(store_id,db.stores, default=store.store_id, writable=False, label='Sucursal',comment='A la que se encuentra asignado'), Field('nota', 'integer', default=None, writable=False,label='No.Nota(Sistema)',comment='Remisión generada por el Sistema'), Field('notaFisica','integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser Numero positivo entre 2500 y 66500')),label='No.Nota(Elaborada)',comment='Remision'), Field('vale', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento para Arm1/Len1'), Field('folio', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe ser Numero positivo entre 11 y 191999')),label='Num.Folio'), Field('first_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'), Field('last_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'), Field('end_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'), Field('tel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Casa'), Field('tel1','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Trabajo'), Field('cel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Celular',comment='Sin 044'), Field('email','string', default=None, requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'), Field('armazon1',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon1'), Field('color1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon1'), Field('lente1',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC1','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 1'), Field('tinte1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('armazon2',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon2'), Field('color2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon2'), Field('lente2',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC2','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 2'), Field('tinte2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('armazon3',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon3'), Field('color3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon3'), Field('lente3',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC3','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 3'), Field('tinte3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
[web2py] Re: Can any help me with crud.create?
Should be fixed now. On Dec 9, 9:08 am, drayco antrod...@gmail.com wrote: Hi, in web2py 1.89.5 works but in trunk no This is in the controller def realizar_venta(): return dict(form=crud.create(db.notas, next=URL(r=request, f='leer_ventas'), onvalidation=procesing_nota, onaccept=procesing_taller)) This is in the model db.define_table(notas, audit, Field(store_id,db.stores, default=store.store_id, writable=False, label='Sucursal',comment='A la que se encuentra asignado'), Field('nota', 'integer', default=None, writable=False,label='No.Nota(Sistema)',comment='Remisión generada por el Sistema'), Field('notaFisica','integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser Numero positivo entre 2500 y 66500')),label='No.Nota(Elaborada)',comment='Remision'), Field('vale', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento para Arm1/Len1'), Field('folio', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe ser Numero positivo entre 11 y 191999')),label='Num.Folio'), Field('first_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'), Field('last_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'), Field('end_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'), Field('tel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Casa'), Field('tel1','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Trabajo'), Field('cel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Celular',comment='Sin 044'), Field('email','string', default=None, requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'), Field('armazon1',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon1'), Field('color1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon1'), Field('lente1',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC1','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 1'), Field('tinte1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('armazon2',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon2'), Field('color2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon2'), Field('lente2',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC2','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 2'), Field('tinte2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('armazon3',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon3'), Field('color3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon3'), Field('lente3',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC3','string',
[web2py] Web2py Application Exhibition Deadline
Hello All, The deadline for submissions for the Web2py Application Exhibition is December 15th 2010 You can start submitting and voting for the entries for the Web2py Application Exhibition Version 2.0 To get started, go to the following link... http://w2pexhibition.appspot.com/ There is a sample application entry by Martin Mulone that will give you and idea of how to use the voting application. Many thanks to Martin Mulone for coding the app to handle submission and voting! Good Luck! Mr.NetAdmin
[web2py] SQLTABLE without THEAD
Hi, Is there a way to generate a SQLTABLE with no THEAD row?. Thanks, Carlos
[web2py] Limit Posts to shorter length add continue reading link
Hello I am wondering if there is a way to limit the posts on my blog main page to say 500 Characters and have a continue reading link from there on each post. This is my query it uses pagination :D *def index(): #Collect all posts in the db and use pagination query = db.posts.id 0 orderby = ~db.posts.id pcache = (cache.ram, 15) paginate = Pagination(db, query, orderby, display_count=5, cache=pcache, r=request, res=response) # Now we get our subset. rows=paginate.get_set(set_links=True) return dict(rows=rows)* and my db tables :-) db.define_table('posts', Field('userinfo', db.auth_user, default=auth.user_id, readable=False, writable=False,unique=True), Field('category',db.category, requires=IS_IN_DB(db,db.category.id ,'%(name)s')), Field('created_on','datetime',default=datetime.datetime.today(),writable=False,readable=False), Field('post_title', length=100, comment='Title of your post', requires=IS_NOT_EMPTY()), Field('post_body', 'text', requires=IS_NOT_EMPTY()), Field('image','upload', label='Image', comment='(Max Size) 600px by 600px', autodelete=True, requires=IS_IMAGE(extensions=('png', 'gif', 'jpg'), maxsize=(600, 600 Thank you for any advice :-)
[web2py] Re: Can any help me with crud.create?
Hi, this is the new traceback Traceback (most recent call last): File /home/drayco/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/drayco/web2py/applications/opticaluz/controllers/ ventas.py, line 1086, in module File /home/drayco/web2py/gluon/globals.py, line 95, in lambda self._caller = lambda f: f() File /home/drayco/web2py/gluon/tools.py, line 2315, in f return action(*a, **b) File /home/drayco/web2py/applications/opticaluz/controllers/ ventas.py, line 1056, in realizar_venta return dict(form=crud.create(db.notas, next=URL(r=request, f='leer_ventas'), onvalidation=procesing_nota, onaccept=procesing_taller)) File /home/drayco/web2py/gluon/tools.py, line 2889, in create deletable=False, File /home/drayco/web2py/gluon/tools.py, line 2805, in update formstyle=self.settings.formstyle File /home/drayco/web2py/gluon/sqlhtml.py, line 792, in __init__ inp = self.widgets.options.widget(field, default) File /home/drayco/web2py/gluon/sqlhtml.py, line 205, in widget options = requires[0].options() File /home/drayco/web2py/gluon/validators.py, line 2350, in _options options = self.other.options() File /home/drayco/web2py/gluon/validators.py, line 424, in options self.build_set() File /home/drayco/web2py/gluon/validators.py, line 408, in build_set records = self.dbset.select(*self.fields, **dd) File /home/drayco/web2py/gluon/dal.py, line 4369, in select return self.db._adapter.select(self.query,fields,attributes) File /home/drayco/web2py/gluon/dal.py, line 976, in select query = self._select(query,fields,attributes) File /home/drayco/web2py/gluon/dal.py, line 911, in _select raise SyntaxError, 'Set: no tables selected' SyntaxError: Set: no tables selected On Dec 9, 9:17 am, mdipierro mdipie...@cs.depaul.edu wrote: Should be fixed now. On Dec 9, 9:08 am, drayco antrod...@gmail.com wrote: Hi, in web2py 1.89.5 works but in trunk no This is in the controller def realizar_venta(): return dict(form=crud.create(db.notas, next=URL(r=request, f='leer_ventas'), onvalidation=procesing_nota, onaccept=procesing_taller)) This is in the model db.define_table(notas, audit, Field(store_id,db.stores, default=store.store_id, writable=False, label='Sucursal',comment='A la que se encuentra asignado'), Field('nota', 'integer', default=None, writable=False,label='No.Nota(Sistema)',comment='Remisión generada por el Sistema'), Field('notaFisica','integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser Numero positivo entre 2500 y 66500')),label='No.Nota(Elaborada)',comment='Remision'), Field('vale', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento para Arm1/Len1'), Field('folio', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe ser Numero positivo entre 11 y 191999')),label='Num.Folio'), Field('first_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'), Field('last_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'), Field('end_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'), Field('tel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Casa'), Field('tel1','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Trabajo'), Field('cel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Celular',comment='Sin 044'), Field('email','string', default=None, requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'), Field('armazon1',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon1'), Field('color1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon1'), Field('lente1',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC1','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 1'), Field('tinte1','string', default=None,
[web2py] Re: Can any help me with crud.create?
can you email me (confidentially) a minimalist app to reproduce the problem? On Dec 9, 9:08 am, drayco antrod...@gmail.com wrote: Hi, in web2py 1.89.5 works but in trunk no This is in the controller def realizar_venta(): return dict(form=crud.create(db.notas, next=URL(r=request, f='leer_ventas'), onvalidation=procesing_nota, onaccept=procesing_taller)) This is in the model db.define_table(notas, audit, Field(store_id,db.stores, default=store.store_id, writable=False, label='Sucursal',comment='A la que se encuentra asignado'), Field('nota', 'integer', default=None, writable=False,label='No.Nota(Sistema)',comment='Remisión generada por el Sistema'), Field('notaFisica','integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser Numero positivo entre 2500 y 66500')),label='No.Nota(Elaborada)',comment='Remision'), Field('vale', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento para Arm1/Len1'), Field('folio', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe ser Numero positivo entre 11 y 191999')),label='Num.Folio'), Field('first_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'), Field('last_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'), Field('end_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'), Field('tel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Casa'), Field('tel1','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Trabajo'), Field('cel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Celular',comment='Sin 044'), Field('email','string', default=None, requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'), Field('armazon1',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon1'), Field('color1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon1'), Field('lente1',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC1','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 1'), Field('tinte1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('armazon2',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon2'), Field('color2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon2'), Field('lente2',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC2','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 2'), Field('tinte2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('armazon3',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon3'), Field('color3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon3'), Field('lente3',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))),
Re: [web2py] Limit Posts to shorter length add continue reading link
Did you see this slice? http://web2pyslices.com/main/slices/take_slice/90 2010/12/9 Andrew Evans randra...@gmail.com Hello I am wondering if there is a way to limit the posts on my blog main page to say 500 Characters and have a continue reading link from there on each post. This is my query it uses pagination :D *def index(): #Collect all posts in the db and use pagination query = db.posts.id 0 orderby = ~db.posts.id pcache = (cache.ram, 15) paginate = Pagination(db, query, orderby, display_count=5, cache=pcache, r=request, res=response) # Now we get our subset. rows=paginate.get_set(set_links=True) return dict(rows=rows)* and my db tables :-) db.define_table('posts', Field('userinfo', db.auth_user, default=auth.user_id, readable=False, writable=False,unique=True), Field('category',db.category, requires=IS_IN_DB(db,db.category.id ,'%(name)s')), Field('created_on','datetime',default=datetime.datetime.today(),writable=False,readable=False), Field('post_title', length=100, comment='Title of your post', requires=IS_NOT_EMPTY()), Field('post_body', 'text', requires=IS_NOT_EMPTY()), Field('image','upload', label='Image', comment='(Max Size) 600px by 600px', autodelete=True, requires=IS_IMAGE(extensions=('png', 'gif', 'jpg'), maxsize=(600, 600 Thank you for any advice :-) -- Bruno Rocha http://about.me/rochacbruno/bio
[web2py] Re: SQLTABLE without THEAD
In trunk now SQLTABLE(...,headers=None) please give it a try. On Dec 9, 10:45 am, Carlos carlosgali...@gmail.com wrote: Hi, Is there a way to generate a SQLTABLE with no THEAD row?. Thanks, Carlos
[web2py] Re: Can any help me with crud.create?
Hi, I send you the application that you request me. I develop that for my wife business. I use ubuntu 10.04, mysql, python 2.6 and web2py version in trunk and in web2py 1.89.5 it works. I hope this help you. On Dec 9, 11:18 am, mdipierro mdipie...@cs.depaul.edu wrote: can you email me (confidentially) a minimalist app to reproduce the problem? On Dec 9, 9:08 am, drayco antrod...@gmail.com wrote: Hi, in web2py 1.89.5 works but in trunk no This is in the controller def realizar_venta(): return dict(form=crud.create(db.notas, next=URL(r=request, f='leer_ventas'), onvalidation=procesing_nota, onaccept=procesing_taller)) This is in the model db.define_table(notas, audit, Field(store_id,db.stores, default=store.store_id, writable=False, label='Sucursal',comment='A la que se encuentra asignado'), Field('nota', 'integer', default=None, writable=False,label='No.Nota(Sistema)',comment='Remisión generada por el Sistema'), Field('notaFisica','integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser Numero positivo entre 2500 y 66500')),label='No.Nota(Elaborada)',comment='Remision'), Field('vale', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento para Arm1/Len1'), Field('folio', 'integer', default=None, requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe ser Numero positivo entre 11 y 191999')),label='Num.Folio'), Field('first_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'), Field('last_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'), Field('end_name','string', default=None, requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'), Field('tel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Casa'), Field('tel1','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Trabajo'), Field('cel','double', default=None, requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')), label='Tel.Celular',comment='Sin 044'), Field('email','string', default=None, requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'), Field('armazon1',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon1'), Field('color1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon1'), Field('lente1',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC1','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 1'), Field('tinte1','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('armazon2',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon2'), Field('color2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon2'), Field('lente2',db.lentes, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','% (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $% (promo)s'))), Field('soloLoC2','string', default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo para lejos'])), label='Lejos ó Cerca 2'), Field('tinte2','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!'))), Field('armazon3',db.eyewear, default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s % (modelo)s %(color)s %(caract1)s $%(promo)s'))), Field('modelo3','string', default=None, requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon3'),
Re: [web2py] Re: How to pass table labels to SQLTABLE headers param?
OK, Forget about it, I just tested and I see that when a field has no Label defined, the label become the fieldname.replace('_',' ').capitalize() Even multiple Joins works ok with headers='labels' but now I understand your point for not taking this as default, because it is more legible tablename.field, anothertable.field when printing it to generic view or debuging. Just need to include that information to the SQLTABLE class docstring. Thank you Massimo for this add, this thread is {{SOLVED}}
Re: [web2py] Re: Changing links on SQLTABLE
I think I do not understant your options very well, but now I am working on the way I mentioned. My SQLTABLE receives a parameter called rd (represent dictionary) and I can pass any string with placeholders and fields to fetch the value. I dont want to change the 'represent' at the model level, because I need different represent to forms and tables, I think it is better to define an exclusive represent dictionary to use in SQLTABLE that do not affects the representation in forms. I will create a slice as soon as I finish that. 2010/12/9 mdipierro mdipie...@cs.depaul.edu Other options: 1) db.table.field.represent=lambda row='row': ... if field.represent.func_defaults[0]=='row': ... 2) db.table.field.represent=lambda row={}: ... if isinstance(field.represent.func_defaults[0],dict): ... 3) if field.represent.func_code.co_varnames[0]=='row': ... this is used in SQLTABLE, FIELD, crud.read, crud.update. Massimo On Dec 8, 11:58 pm, Bruno Rocha rochacbr...@gmail.com wrote: I am overriding SQLTABLE class, here is my idea, let me know if this is a stupid idea :P I want to pass to SQLTABLE a represent_dictionary which I call 'rd', so if I have a table: table db.define_table('person', Field('name'), Field('city'), Field('state'), Field('email') ) /table My rd will be: code rd = dict(person.email={'repr_string':A(_href=URL('changemail',vars=dict(person_id='%s'))), 'fetch':'person.id'}) # I want to pass rd to SQLTABLE code mytable = SQLTABLE(Rows,rd=rd) /code Now in SQLTABLE for each column name, I will check if there is a entry for this key in 'rd', if True: code for i,row in enumerate(sqlrows): field.represent = rd[columnname]['repr_string'] % row[rd['fetch']] /code This way, I can always pass a dict containing a string with placeholders to override the represent for any column in the table, and this dict will contains which column value will be fetched for every row. I am making some tests, I just need a way to include some html tags including another field values, as ID for every column. Is that a stupid idea? :P Thanks epresent: lambda row: 2010/12/9 mdipierro mdipie...@cs.depaul.edu Sorry. Cannot be done this way. Represent takes the field value, not the entire row. The reason is that when web2py tries to represent a field in a SQLTABLE or in a FORM, only that field is guaranteed to be there. the other fields may not have been fetched from the database. Anyway... I will think this can be improved. Let us know if you have any idea. Massimo On Dec 8, 10:13 pm, Bruno Rocha rochacbr...@gmail.com wrote: I Know this is an VERY OLD post, but I was searching the group and I now have the same need as weheh in this thread. db.define_table('person', Field('name'), Field('city'), Field('state'), Field('email',represent: lambda row: A(_href=URL('changemail',vars=dict(person_id=row.id ) But, lambda in this case is getting row as str() with the mail adress stored in 'email' field, I need to have the row id. another easy way? I am thinking about override the SQLTABLE class to include this kind of option if I can't find an easy solution. -- Bruno Rochahttp://about.me/rochacbruno/bio -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] Limit Posts to shorter length add continue reading link
Hi Bruno ty for the reply. I am just trying to figure out that code but for some reason it isn't displaying the post_body when I view the page Any ideas in how to fix this? def index(): posts = db(db.posts.id 0).select(orderby=~db.posts.id, limitby=(0, 10)) for post in posts: if len(post.post_body) 1000:# Preview should be about 1000 chars index = post.post_body.find(/p, 1000, -1) + 4 # find the index of the next /p and add 4 chars post.post_body = post.post_body[0:index] # replace the body of the post post with short version return dict(rows=posts)
[web2py] Re: SQLTABLE without THEAD
Thanks Massimo ! On Dec 9, 11:25 am, mdipierro mdipie...@cs.depaul.edu wrote: In trunk now SQLTABLE(...,headers=None) please give it a try. On Dec 9, 10:45 am, Carlos carlosgali...@gmail.com wrote: Hi, Is there a way to generate a SQLTABLE with no THEAD row?. Thanks, Carlos
Re: [web2py] Limit Posts to shorter length add continue reading link
Never mind found it I guess my nicedit wasn't adding p tags but br On Thu, Dec 9, 2010 at 10:12 AM, Andrew Evans randra...@gmail.com wrote: Hi Bruno ty for the reply. I am just trying to figure out that code but for some reason it isn't displaying the post_body when I view the page Any ideas in how to fix this? def index(): posts = db(db.posts.id 0).select(orderby=~db.posts.id, limitby=(0, 10)) for post in posts: if len(post.post_body) 1000:# Preview should be about 1000 chars index = post.post_body.find(/p, 1000, -1) + 4 # find the index of the next /p and add 4 chars post.post_body = post.post_body[0:index] # replace the body of the post post with short version return dict(rows=posts)
[web2py] Implement plugin wiki in an existing site...
I have converted a design over to web2py with little effort. But I would like to have wiki functionality for each page like the plugin wiki. I don't use the same menu system but I suppose I could. How do I get menus and wiki to work on each page I want to create? I looked here, but it was only for a fresh install... http://www.web2py.com/book/default/chapter/13?search=wiki#plugin_wiki Best Regards, Jason Brower
[web2py] Re: Deployment of web2py on an intranet
OK. I will give it a try and get back to you On Dec 7, 8:13 pm, mdipierro mdipie...@cs.depaul.edu wrote: When you start web2py you need to specify the IP address web2py.py -i 192.168.0.1 -p 8000 -a 'password' On Dec 7, 5:28 am,RupeshPradhan rupeshkrprad...@gmail.com wrote: I have two computers networked together using LAN cable with name 'server'(192.168.0.1) and 'machine01'(192.168.0.2) I have installed web2py on the 'server'. After running the 'web2py_no_console' on the server (thehttp://localhost:8000showsthe welcome page), I tried to access the webpage through machine01 by typinghttp://server:8000ORhttp://192.168.0.1:8000. It does not work. What am I missing here?
Re: [web2py] Re: Changing links on SQLTABLE
You can put anything in SQLTABLE by modifying Rows object with rows.setvirtualfields. See this post http://groups.google.com/group/web2py/browse_thread/thread/826a37f56c26d689
[web2py] Re: orderby='random' on Google App Engine
as far as i know you would have to write some custom big table queries (not using web2py dal). but in theory you could: - write a direct query to get all the keys of a table (and no data) - cache those keys - randomly choose a set of keys from the full list - write a google key query. google is not really set up for selecting random data... cfh
[web2py] Re: partial csv import
Just ran another test from scratch. Did the same thing. It puts the , in the first 15 rows then stops. If I put something in the bottom right hand column, it'll put commas starting after the preceding row multiple of 16. No big deal now that I know what it is doing. ... key94,value94 key95,value95 key96,value96, key97,value97, key98,value98, key99,value99,1 On Dec 7, 3:51 pm, Kenneth Lundström kenneth.t.lundst...@gmail.com wrote: Just curious but are you sure that column 3 on rows 1-15 and 32 onward are empty.
[web2py] Re: web2py themes - feeling nostalgic?
Hi John, .hidden is part of the Web2py base.css I am having difficulty finding the buttons you are referring to, how about a url or perhaps the html where .hidden is being applied. are you talking about in appadmin under state? http://127.0.0.1:8000/a/appadmin/state Chris On Dec 9, 1:41 am, John Kim left...@gmail.com wrote: Thanks~ Comparing these different themes, I found a bug in the current 1.89.5 theme: The default view shows four buttons: admin, request, session, and response. The last three buttons should expand to show some useful information. However, the information has a CSS visibility: hidden; property so it can't be seen! This property was inherited from div#request_hidden (base.css:232). The information becomes visible if I uncheck this property from Chrome developer tools. How should this be fixed? Is there a reason the CSS file sets the visibility to hidden? John-Kim On Dec 8, 4:39 am, Chris Steel chris.st...@gmail.com wrote: I was playing with plugin_layout and could not resist the temptation to bring back the past. Of course then you might want to get back the current Web2py theme, so I did one for that as well. Untested, Have fun... -- Christopher Steel Voice of Access web2py.plugin.layout_BlankBluegreen.w2p 77KViewDownload web2py.plugin.layout_blank_1_81_5.w2p 60KViewDownload web2py.plugin.layout_1_89_5.w2p 186KViewDownload
Re: [web2py] Re: Changing links on SQLTABLE
This: code class ExtraField: def new_column(self): if self.task.id==1: return A('some_action_link', _href=URL(f='default', args=[self.task.id])) else: return A('great thing', _href='http://www.web2py.com') def test(): rows=db(db.task).select() rows.colnames.append('task.new_column') rows.setvirtualfields(task=ExtraField()) table=SQLTABLE(rows) return dict(table=table) /code Is not working raising this error: Traceback (most recent call last): File /Users/brunomac/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /Users/brunomac/web2py/applications/satlite/controllers/teste.py http://127.0.0.1:8000/admin/default/edit/satlite/controllers/teste.py, line 71, in module File /Users/brunomac/web2py/gluon/globals.py, line 96, in lambda self._caller = lambda f: f() File /Users/brunomac/web2py/applications/satlite/controllers/teste.py http://127.0.0.1:8000/admin/default/edit/satlite/controllers/teste.py, line 20, in test table=SQLTABLE(rows) File /Users/brunomac/web2py/gluon/sqlhtml.py, line 1241, in __init__ File /Users/brunomac/web2py/gluon/sql.py, line 3787, in __str__ self.export_to_csv_file(s) File /Users/brunomac/web2py/gluon/sql.py, line 3771, in export_to_csv_file field = self.db[t][f] File /Users/brunomac/web2py/gluon/sql.py, line 1668, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'new_column' 2010/12/9 Ivan Matveev imatvee...@gmail.com You can put anything in SQLTABLE by modifying Rows object with rows.setvirtualfields. See this post http://groups.google.com/group/web2py/browse_thread/thread/826a37f56c26d689 -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] Re: web2py themes - feeling nostalgic?
*You can see the four buttons by creating any action that doesn't have a view explicitly defined for it. So you could add an action to the welcome app default.py controller:* def action_without_a_view(): return dict(message='Buttons are below...') Then browse to localhost:8000/welcome/default/action_without_a_view/ *The relevant HTML is in generic.html:* button onclick=document.location='{{=URL(admin,default,design,args=request.application)}}'admin/button button onclick=jQuery('#request').slideToggle()request/button div class=hidden id=requesth2request/h2{{=BEAUTIFY(request)}}/div button onclick=jQuery('#session').slideToggle()session/button div class=hidden id=sessionh2session/h2{{=BEAUTIFY(session)}}/div button onclick=jQuery('#response').slideToggle()response/button div class=hidden id=responseh2response/h2{{=BEAUTIFY(response)}}/div scriptjQuery('.hidden').hide();/script *I removed the visibility: hidden; attribute from line 232 of base.css and it fixes the problem. This change does not seem to break anything else...* John On Fri, Dec 10, 2010 at 6:38 AM, Christopher Steel chris.st...@gmail.comwrote: Hi John, .hidden is part of the Web2py base.css I am having difficulty finding the buttons you are referring to, how about a url or perhaps the html where .hidden is being applied. are you talking about in appadmin under state? http://127.0.0.1:8000/a/appadmin/state Chris On Dec 9, 1:41 am, John Kim left...@gmail.com wrote: Thanks~ Comparing these different themes, I found a bug in the current 1.89.5 theme: The default view shows four buttons: admin, request, session, and response. The last three buttons should expand to show some useful information. However, the information has a CSS visibility: hidden; property so it can't be seen! This property was inherited from div#request_hidden (base.css:232). The information becomes visible if I uncheck this property from Chrome developer tools. How should this be fixed? Is there a reason the CSS file sets the visibility to hidden? John-Kim On Dec 8, 4:39 am, Chris Steel chris.st...@gmail.com wrote: I was playing with plugin_layout and could not resist the temptation to bring back the past. Of course then you might want to get back the current Web2py theme, so I did one for that as well. Untested, Have fun... -- Christopher Steel Voice of Access web2py.plugin.layout_BlankBluegreen.w2p 77KViewDownload web2py.plugin.layout_blank_1_81_5.w2p 60KViewDownload web2py.plugin.layout_1_89_5.w2p 186KViewDownload
Re: [web2py] Re: Changing links on SQLTABLE
Note that when I do: print sqlrows.colnames in sqlhtml.py I get: ['task.id', 'task.title', 'task.story', 'task.type', 'task.body', 'task.priority', 'task.assigned_to', 'task.estimated_hours', 'task.spent_hours', 'task.status', 'task.created_on', 'task.created_by', 'task.updated_on', 'task.updated_by', 'task.*new_column*'] 2010/12/9 Bruno Rocha rochacbr...@gmail.com This: code class ExtraField: def new_column(self): if self.task.id==1: return A('some_action_link', _href=URL(f='default', args=[self.task.id])) else: return A('great thing', _href='http://www.web2py.com') def test(): rows=db(db.task).select() rows.colnames.append('task.new_column') rows.setvirtualfields(task=ExtraField()) table=SQLTABLE(rows) return dict(table=table) /code Is not working raising this error: Traceback (most recent call last): File /Users/brunomac/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /Users/brunomac/web2py/applications/satlite/controllers/teste.py http://127.0.0.1:8000/admin/default/edit/satlite/controllers/teste.py, line 71, in module File /Users/brunomac/web2py/gluon/globals.py, line 96, in lambda self._caller = lambda f: f() File /Users/brunomac/web2py/applications/satlite/controllers/teste.py http://127.0.0.1:8000/admin/default/edit/satlite/controllers/teste.py, line 20, in test table=SQLTABLE(rows) File /Users/brunomac/web2py/gluon/sqlhtml.py, line 1241, in __init__ File /Users/brunomac/web2py/gluon/sql.py, line 3787, in __str__ self.export_to_csv_file(s) File /Users/brunomac/web2py/gluon/sql.py, line 3771, in export_to_csv_file field = self.db[t][f] File /Users/brunomac/web2py/gluon/sql.py, line 1668, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'new_column' 2010/12/9 Ivan Matveev imatvee...@gmail.com You can put anything in SQLTABLE by modifying Rows object with rows.setvirtualfields. See this post http://groups.google.com/group/web2py/browse_thread/thread/826a37f56c26d689 -- Bruno Rocha http://about.me/rochacbruno/bio -- Bruno Rocha http://about.me/rochacbruno/bio
[web2py] Re: patch to make Rows.setvirtualfields work with SQLTABLE
I think this patch needs to be reviewed, as sqlhtml.py changed a lot.
[web2py] Errors when a table references itself (was Re: What does this mean?)
My database table started giving errors when I added a field that references itself. I think it is related to the other messages in this thread because I get the same error message: RuntimeError: Using a recursive select but encountered a broken reference This error is raised after I use the appadmin interface to insert an element (http://localhost:8000/inbite/appadmin/insert/db/inbite) and then query all the rows in the table (http://localhost:8000/inbite/appadmin/select/db?query=db.inbite.id%3E0) The error is propogated from line 191 of appadmin.html: response.write(SQLTABLE(rows,linkto,upload,orderby=True,_class='sortable')) until line 1537 of sql.py in __allocate If I drop the table, the error is not raised until I insert another row. Also if I comment out the field that adds the self-referential column, the error is not raised. I can also continue to keep inserting more rows via the appadmin interface. Here is the model: db.define_table('inbite', Field('code', 'string', length= 8, default=None, required=True, notnull=True, unique=True), Field('email', 'string', length=50, default=None, notnull=False, unique=False), Field('invites_left', 'integer', default=2), Field('parent', 'reference inbite', default=None) ) I have a feeling the error might be related to SQLite broken migrations. The parent field used to be a string before I learned self-referential fields were possible. However, I dropped the table so indexing started at 1 again; is this enough to rule out SQLite migration issues? Thanks for any assistance~ John
Re: [web2py] Re: Changing links on SQLTABLE
I just got it! the problem is in definition of headers, when headers=None this works well. I am going to patch for this. 2010/12/9 Bruno Rocha rochacbr...@gmail.com Note that when I do: print sqlrows.colnames in sqlhtml.py I get: ['task.id', 'task.title', 'task.story', 'task.type', 'task.body', 'task.priority', 'task.assigned_to', 'task.estimated_hours', 'task.spent_hours', 'task.status', 'task.created_on', 'task.created_by', 'task.updated_on', 'task.updated_by', 'task.*new_column*'] 2010/12/9 Bruno Rocha rochacbr...@gmail.com This: code class ExtraField: def new_column(self): if self.task.id==1: return A('some_action_link', _href=URL(f='default', args=[self.task.id])) else: return A('great thing', _href='http://www.web2py.com') def test(): rows=db(db.task).select() rows.colnames.append('task.new_column') rows.setvirtualfields(task=ExtraField()) table=SQLTABLE(rows) return dict(table=table) /code Is not working raising this error: Traceback (most recent call last): File /Users/brunomac/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /Users/brunomac/web2py/applications/satlite/controllers/teste.py http://127.0.0.1:8000/admin/default/edit/satlite/controllers/teste.py, line 71, in module File /Users/brunomac/web2py/gluon/globals.py, line 96, in lambda self._caller = lambda f: f() File /Users/brunomac/web2py/applications/satlite/controllers/teste.py http://127.0.0.1:8000/admin/default/edit/satlite/controllers/teste.py, line 20, in test table=SQLTABLE(rows) File /Users/brunomac/web2py/gluon/sqlhtml.py, line 1241, in __init__ File /Users/brunomac/web2py/gluon/sql.py, line 3787, in __str__ self.export_to_csv_file(s) File /Users/brunomac/web2py/gluon/sql.py, line 3771, in export_to_csv_file field = self.db[t][f] File /Users/brunomac/web2py/gluon/sql.py, line 1668, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'new_column' 2010/12/9 Ivan Matveev imatvee...@gmail.com You can put anything in SQLTABLE by modifying Rows object with rows.setvirtualfields. See this post http://groups.google.com/group/web2py/browse_thread/thread/826a37f56c26d689 -- Bruno Rocha http://about.me/rochacbruno/bio -- Bruno Rocha http://about.me/rochacbruno/bio -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] Re: patch to make Rows.setvirtualfields work with SQLTABLE
This is my working code: http://snipt.net/rochacbruno/virtual-fields-in-sqltabe Note the headers=None So need to patch the header definition to use the virtualfieldname, or better, *How to define a label for a virtual field?* * * for work with SQLTABLE (or plugin_datatable) we need to add the colname for every virtual field: *myrows.colnames.append('task.teste')* *How to append every virtual field to rows.colnames?* I think this could be done in sqlhtml.py as: for field in sqlrows.virtualfields: sqlrows.colnames.append('tablename.'+field) *Is it possible?*
Re: [web2py] Errors when a table references itself (was Re: What does this mean?)
Your code works on my 3 weeks old web2py and MySQL. I can insert/view the table with db admin.
[web2py] grid
http://www.noupe.com/javascript/jquery-html-table-toolbox.html
[web2py] Re: Off Topic: HTML5 webapps with Google Closure, Clojure and NoSQL db's
thanks - I have been reading that book and heard of plovr If your large app public?
[web2py] Re: web2py themes - feeling nostalgic?
I do not have that in line 232 in my base.css. That has been already remove from trunk some time ago but the change has not yet propagated in stable. Thanks for confirming that was a problem. It will soon be in stable. Massimo On Dec 9, 4:00 pm, John-Kim Murphy left...@gmail.com wrote: *You can see the four buttons by creating any action that doesn't have a view explicitly defined for it. So you could add an action to the welcome app default.py controller:* def action_without_a_view(): return dict(message='Buttons are below...') Then browse to localhost:8000/welcome/default/action_without_a_view/ *The relevant HTML is in generic.html:* button onclick=document.location='{{=URL(admin,default,design,args=request.application)}}'admin/button button onclick=jQuery('#request').slideToggle()request/button div class=hidden id=requesth2request/h2{{=BEAUTIFY(request)}}/div button onclick=jQuery('#session').slideToggle()session/button div class=hidden id=sessionh2session/h2{{=BEAUTIFY(session)}}/div button onclick=jQuery('#response').slideToggle()response/button div class=hidden id=responseh2response/h2{{=BEAUTIFY(response)}}/div scriptjQuery('.hidden').hide();/script *I removed the visibility: hidden; attribute from line 232 of base.css and it fixes the problem. This change does not seem to break anything else...* John On Fri, Dec 10, 2010 at 6:38 AM, Christopher Steel chris.st...@gmail.comwrote: Hi John, .hidden is part of the Web2py base.css I am having difficulty finding the buttons you are referring to, how about a url or perhaps the html where .hidden is being applied. are you talking about in appadmin under state? http://127.0.0.1:8000/a/appadmin/state Chris On Dec 9, 1:41 am, John Kim left...@gmail.com wrote: Thanks~ Comparing these different themes, I found a bug in the current 1.89.5 theme: The default view shows four buttons: admin, request, session, and response. The last three buttons should expand to show some useful information. However, the information has a CSS visibility: hidden; property so it can't be seen! This property was inherited from div#request_hidden (base.css:232). The information becomes visible if I uncheck this property from Chrome developer tools. How should this be fixed? Is there a reason the CSS file sets the visibility to hidden? John-Kim On Dec 8, 4:39 am, Chris Steel chris.st...@gmail.com wrote: I was playing with plugin_layout and could not resist the temptation to bring back the past. Of course then you might want to get back the current Web2py theme, so I did one for that as well. Untested, Have fun... -- Christopher Steel Voice of Access web2py.plugin.layout_BlankBluegreen.w2p 77KViewDownload web2py.plugin.layout_blank_1_81_5.w2p 60KViewDownload web2py.plugin.layout_1_89_5.w2p 186KViewDownload
Re: [web2py] Re: patch to make Rows.setvirtualfields work with SQLTABLE
This is my working code: http://snipt.net/rochacbruno/virtual-fields-in-sqltabe Note the headers=None So need to patch the header definition to use the virtualfieldname, or better, How to define a label for a virtual field? I think you can try to add label property to your MyVirtualFields class. Like: __init__(self): self.label = mylabel for work with SQLTABLE (or plugin_datatable) we need to add the colname for every virtual field: myrows.colnames.append('task.teste') How to append every virtual field to rows.colnames? I think this could be done in sqlhtml.py as: for field in sqlrows.virtualfields: sqlrows.colnames.append('tablename.'+field) Is it possible? Its late, I can be understanding you wrong. Why you don't want to do it by hand the way it is in your code? myrows.colnames.append('task.teste')
Re: [web2py] Errors when a table references itself (was Re: What does this mean?)
*I figured it out. I needed to add this validator:* db.inbite.parent.requires = IS_EMPTY_OR(IS_IN_DB(db, 'inbite.id', zero='None')) Otherwise the appadmin insert was inserting rows with parent=0, thus introducing a reference to a non-existent row. This also happens with the Web2Py book example for self-reference (person table with father and mother) - note: inserts via the CLI (like in the book) do not cause problems in the appadmin query page - only when a row is inserted via the appadmin interface with a default, blank self-reference field Is there a better method for adding a self-referential field that can point to nothing? *Now I get a new error when I click the 'None' reference. This is not such a big deal, though:* ValueError: invalid literal for int() with base 10: 'None' John On Fri, Dec 10, 2010 at 8:08 AM, Ivan Matveev imatvee...@gmail.com wrote: Your code works on my 3 weeks old web2py and MySQL. I can insert/view the table with db admin.
Re: [web2py] Re: patch to make Rows.setvirtualfields work with SQLTABLE
*Solution to the error*: *code file=sqlhtml.py line=1253* elif headers=='labels': headers = {} for c in columns: (t,f) = c.split('.') try: field = sqlrows.db[t][f] headers[c] = field.label except KeyError: headers[c] = ' '.join([w.capitalize() for w in c.split('.')[-1].split('_')]) */code* I am still looking for a solution to: 1. Set labels for virtual fields (because I need to use T() in the virtual field label) 2. Include the virtual fields in sqlrows.colnames automatically 2010/12/9 Ivan Matveev imatvee...@gmail.com This is my working code: http://snipt.net/rochacbruno/virtual-fields-in-sqltabe Note the headers=None So need to patch the header definition to use the virtualfieldname, or better, How to define a label for a virtual field? I think you can try to add label property to your MyVirtualFields class. Like: __init__(self): self.label = mylabel for work with SQLTABLE (or plugin_datatable) we need to add the colname for every virtual field: myrows.colnames.append('task.teste') How to append every virtual field to rows.colnames? I think this could be done in sqlhtml.py as: for field in sqlrows.virtualfields: sqlrows.colnames.append('tablename.'+field) Is it possible? Its late, I can be understanding you wrong. Why you don't want to do it by hand the way it is in your code? myrows.colnames.append('task.teste') -- Bruno Rocha http://about.me/rochacbruno/bio
[web2py] Re: Errors when a table references itself (was Re: What does this mean?)
I think you want zero=None instead of zero='None', right? On Dec 9, 5:53 pm, John-Kim Murphy left...@gmail.com wrote: *I figured it out. I needed to add this validator:* db.inbite.parent.requires = IS_EMPTY_OR(IS_IN_DB(db, 'inbite.id', zero='None')) Otherwise the appadmin insert was inserting rows with parent=0, thus introducing a reference to a non-existent row. This also happens with the Web2Py book example for self-reference (person table with father and mother) - note: inserts via the CLI (like in the book) do not cause problems in the appadmin query page - only when a row is inserted via the appadmin interface with a default, blank self-reference field Is there a better method for adding a self-referential field that can point to nothing? *Now I get a new error when I click the 'None' reference. This is not such a big deal, though:* ValueError: invalid literal for int() with base 10: 'None' John On Fri, Dec 10, 2010 at 8:08 AM, Ivan Matveev imatvee...@gmail.com wrote: Your code works on my 3 weeks old web2py and MySQL. I can insert/view the table with db admin.
Re: [web2py] Re: Errors when a table references itself (was Re: What does this mean?)
They both work, but there is a slight difference: zero='None' shows 'None' in the drop-down menu zero=None just shows a blank menu-item I wanted to show the text. On Fri, Dec 10, 2010 at 9:24 AM, mr.freeze nat...@freezable.com wrote: I think you want zero=None instead of zero='None', right? On Dec 9, 5:53 pm, John-Kim Murphy left...@gmail.com wrote: *I figured it out. I needed to add this validator:* db.inbite.parent.requires = IS_EMPTY_OR(IS_IN_DB(db, 'inbite.id', zero='None')) Otherwise the appadmin insert was inserting rows with parent=0, thus introducing a reference to a non-existent row. This also happens with the Web2Py book example for self-reference (person table with father and mother) - note: inserts via the CLI (like in the book) do not cause problems in the appadmin query page - only when a row is inserted via the appadmin interface with a default, blank self-reference field Is there a better method for adding a self-referential field that can point to nothing? *Now I get a new error when I click the 'None' reference. This is not such a big deal, though:* ValueError: invalid literal for int() with base 10: 'None' John On Fri, Dec 10, 2010 at 8:08 AM, Ivan Matveev imatvee...@gmail.com wrote: Your code works on my 3 weeks old web2py and MySQL. I can insert/view the table with db admin.
[web2py] format vs represent vs IS_IN_DB(..., label='', ...)
In the Web2Py book section describing the format attribute of a table there is a brief mention of represent. It seems they serve related but different purposes. Also the label parameter of IS_IN_DB() is also very similar. They all have the same format, anyways (and accept lambda functions) What are the different situations where these should be used? I have not been able to produce any noticeable results from format, I'm not sure now to use represent, and IS_IN_DB(.., label) formats menu items in the drop down when inserting via appadmin. (I was originally trying to format the references in the appadmin query interface) John
[web2py] Re: format vs represent vs IS_IN_DB(..., label='', ...)
Represent functions are used to control the display of a field's value for output in forms: db.thing.id.represent = lambda value: A(value,_href=URL('show',args=value)) Widget functions are used to control the input of a field's value in forms: db.thing.name.widget = lambda field,value: SQLFORM.widgets.string.widget(field,value) Format is a convenience that sets a represent function on a table so that referencing fields display useful information instead of the record id in forms. It also sets a validator (IS_IN_DB), which in turn sets a widget (SQLFORM.widgets.options.widget) so that forms use a dropdown of the referenced field's available values. On Dec 9, 6:46 pm, John-Kim Murphy left...@gmail.com wrote: In the Web2Py book section describing the format attribute of a table there is a brief mention of represent. It seems they serve related but different purposes. Also the label parameter of IS_IN_DB() is also very similar. They all have the same format, anyways (and accept lambda functions) What are the different situations where these should be used? I have not been able to produce any noticeable results from format, I'm not sure now to use represent, and IS_IN_DB(.., label) formats menu items in the drop down when inserting via appadmin. (I was originally trying to format the references in the appadmin query interface) John
[web2py] What's the preferred way to clean up the URLs?
What's the preferred way to clean up the URLs? For example, I never want /myapp/default/index to display. /myapp is OK during development and/or when I'm on a server with multiple apps. But when I'm on a domain/server with one app, I want http://myserver.com/; to go to my home page without showing the path. Then, I think what I want is: if there are 0 segments, it routes to /myapp/default/index. If one segment, it routes to /myapp/default/segment1. If 2 segments, /myapp/segment1/segment2. And also handle where the last segment is an ID. /index should never display and simply be implied by /. Would I need routes for all of this? I know I can set myapp to init or welcome (or change the default app name) but that leads to the whole path showing.
Re: [web2py] What's the preferred way to clean up the URLs?
On Dec 9, 2010, at 5:59 PM, pbreit wrote: What's the preferred way to clean up the URLs? For example, I never want /myapp/default/index to display. /myapp is OK during development and/or when I'm on a server with multiple apps. But when I'm on a domain/server with one app, I want http://myserver.com/; to go to my home page without showing the path. Then, I think what I want is: if there are 0 segments, it routes to /myapp/default/index. If one segment, it routes to /myapp/default/segment1. If 2 segments, /myapp/segment1/segment2. And also handle where the last segment is an ID. /index should never display and simply be implied by /. Would I need routes for all of this? I know I can set myapp to init or welcome (or change the default app name) but that leads to the whole path showing. That won't show the whole path to the extent that the path is the default one, but in order to handle segments as you describe, you need to use routes. Here's routes.py from one of my apps: routes_in = ( ('/?', '/vpepm/'), ('/(?Papp(admin|examples|welcome|vpepm))','/\gapp/'), ('/(?Papp(admin|examples|welcome|vpepm))/(?Pany.*)','/\gapp/\gany'), ('/favicon.ico', '/vpepm/static/img/favicon.ico'), ('/robots.txt', '/vpepm/static/robots.txt'), ('/(?Pctlr(sysadmin|appadmin|css|static|init\\b))(?Pany.*)', '/vpepm/\gctlr\gany'), ('/(?Pany.*)','/vpepm/default/\gany'), ) routes_out = ( ('/(?Papp(admin|examples|welcome))/(?Pany.*)','/\gapp/\gany'), ('/vpepm(/default)?/?', '/'), ('/vpepm(/default(/index)?)?/?', '/'), ('/vpepm/default/(?Pany.*)','/\gany'), ('/vpepm/(?Pany.*)','/\gany'), ) The name of the app is (obviously) vpepm. I want to be able to access the standard web2py-supplied apps as well, so you see their names. In order to distinguish controller-segments from function-segments, routes needs to know what vpepm's controllers are, which you see in the penultimate pattern of routes_in. So if I specify a just a function (which can't collide with my controller names), it's treated as segment2 in my default controller.
Re: [web2py] What's the preferred way to clean up the URLs?
I am using autoroutes, but I need to write all my functions under a single controller, for a simple website this is very good because I can have every action(page) inside the default.py controller. with autoroutes my http://blouweb.com/init/default/quemsomos is now just http://blouweb.com/quemsomos But I think you can keep /default with autoroutes. http://snipt.net/rochacbruno/routesconf/ http://snipt.net/rochacbruno/routespy/ 2010/12/9 pbreit pbreitenb...@gmail.com What's the preferred way to clean up the URLs? For example, I never want /myapp/default/index to display. /myapp is OK during development and/or when I'm on a server with multiple apps. But when I'm on a domain/server with one app, I want http://myserver.com/; to go to my home page without showing the path. Then, I think what I want is: if there are 0 segments, it routes to /myapp/default/index. If one segment, it routes to /myapp/default/segment1. If 2 segments, /myapp/segment1/segment2. And also handle where the last segment is an ID. /index should never display and simply be implied by /. Would I need routes for all of this? I know I can set myapp to init or welcome (or change the default app name) but that leads to the whole path showing. -- Bruno Rocha http://about.me/rochacbruno/bio
[web2py] it case you missed it...
... we are having some fun over at reddit again: http://www.reddit.com/r/Python/comments/ej0p1/new_standalone_web2py_database_abstraction_layer/ I am emailing you because you have asked in the past and because other people felt the need to tweet about their own comments: http://friendfeed.com/ericflo/e28441ba/ericflo-on-new-stand-alone-web2py-database I am not asking nor encouraging you to post. I just thought you would be interested about the ongoing discussion. Massimo
[web2py] Re: SQLForm.factory and identic fields names in differents tables
I was wondering that myself. I got this to almost work but it is not inserting the address.client_id so there's no link between the records. Inserting into two tables seems extremely common. Hopefully this won't be too difficult.
[web2py] Re: SQLForm.factory and identic fields names in differents tables
My bad. I had named the field db.address.client_id. Works fine now. But field name conflicts seem like they will be a problem at some point.
Re: [web2py] it case you missed it...
Very good thread! BTW: Is that tricks on the book? http://www.reddit.com/r/Python/comments/ej0p1/new_standalone_web2py_database_abstraction_layer/c18hkjf and, I completely agree with the 4th idea here: http://www.reddit.com/r/Python/comments/ej0p1/new_standalone_web2py_database_abstraction_layer/c18grty But, I like the fact DAL is a single file, for me it is better to be a single file, better to maintain and keep my projects updated. I have a PyGTK program running with SQL.py and I will update this to the new dal.py this weekend, I prefer to update a single file. better if I can do: $easy_install dal 2010/12/10 mdipierro mdipie...@cs.depaul.edu ... we are having some fun over at reddit again: http://www.reddit.com/r/Python/comments/ej0p1/new_standalone_web2py_database_abstraction_layer/ I am emailing you because you have asked in the past and because other people felt the need to tweet about their own comments: http://friendfeed.com/ericflo/e28441ba/ericflo-on-new-stand-alone-web2py-database I am not asking nor encouraging you to post. I just thought you would be interested about the ongoing discussion. Massimo -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] Re: new dal
There seems to be a problem with options widget and new dal: http://code.google.com/p/web2py/issues/detail?id=136 Widget seems to be generating string fields (i.e. 'tipo_cbte.desc, tipo_cbte.cod'), and dal is specting Expressions. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com
Re: [web2py] grid
Thank you for sharing this good stuff. I selected the best plugins to test: http://flexigrid.info/ (seens to be the best, better than jqgrid in my opinion) http://www.sprymedia.co.uk/article/KeyTable (very nice edit inplace feature) http://www.rebeccamurphey.com/jquery/graphTable/table.html (Cool, because canbe used together with any table) http://www.datatables.net/ (this one of plugin_datatabe, already in web2py/plugins, but needs to be updated, new version has a better layout and it is faster) http://boriscy.github.com/grider/# (This can do client side computed fields) http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/ (I am trying to use this together with datatables plugin) http://www.jankoatwarpspeed.com/post/2009/07/20/Expand-table-rows-with-jQuery-jExpand-plugin.aspx (Another nice feature I need in datatables plugin) The question, how to have all the features in a single table? just as telerik does in asp.net, and without the need to buy Ext.js/sencha license ? 2010/12/9 Richard Vézina ml.richard.vez...@gmail.com http://www.noupe.com/javascript/jquery-html-table-toolbox.html -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] it case you missed it...
Frankly, DAL is the only thing that kept me from really digging into web2py. I just cannot wrap my brain around it. Could be some malfunction on my part, but still. I'm much happier typing away SQL or having wrapper functions that work almost as if you're typing SQL. The perfect thing for me was web.py's web.db. :) On Fri, Dec 10, 2010 at 4:12 AM, Bruno Rocha rochacbr...@gmail.com wrote: Very good thread! BTW: Is that tricks on the book? http://www.reddit.com/r/Python/comments/ej0p1/new_standalone_web2py_database_abstraction_layer/c18hkjf and, I completely agree with the 4th idea here: http://www.reddit.com/r/Python/comments/ej0p1/new_standalone_web2py_database_abstraction_layer/c18grty But, I like the fact DAL is a single file, for me it is better to be a single file, better to maintain and keep my projects updated. I have a PyGTK program running with SQL.py and I will update this to the new dal.py this weekend, I prefer to update a single file. better if I can do: $easy_install dal 2010/12/10 mdipierro mdipie...@cs.depaul.edu ... we are having some fun over at reddit again: http://www.reddit.com/r/Python/comments/ej0p1/new_standalone_web2py_database_abstraction_layer/ I am emailing you because you have asked in the past and because other people felt the need to tweet about their own comments: http://friendfeed.com/ericflo/e28441ba/ericflo-on-new-stand-alone-web2py-database I am not asking nor encouraging you to post. I just thought you would be interested about the ongoing discussion. Massimo -- Bruno Rocha http://about.me/rochacbruno/bio -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] SEO Tips How this can be applied in web2py apps?
I just read this post: http://www.seomoz.org/blog/the-web-developers-seo-cheat-sheet Also available in pdf: http://www.seomoz.org/user_files/SEO_Web_Developer_Cheat_Sheet.pdf I am thinking on how we can have some helpers, functions, directives or just improvements in 'welcome' app to help us follow this SEO tips? Any idea? -- Bruno Rocha http://about.me/rochacbruno/bio
[web2py] Re: Get User [auth_user] Janrain
You need to add your domain to the token_url whitelist which you can find on janrain.com under deployment domains and settings. If you are working locally try adding 'localhost' if you are working from a webdomain that is already hosted try adding that domain's name. On the offchance that you are working in a subdomain try: *.yourdomain.com Hope this helps. On Nov 24, 2:32 pm, Andrew Evans randra...@gmail.com wrote: Hello I solved my error by adding auth.define_tables() to the mix Janrain loads as expected except when I try to login. Any idea how to solve this issue, I get the following error Invalid argument: token_url domain not in whitelist
[web2py] Re: needs more new dal testers
I've never used either one before. But no errors on pypy-1.4. For jython-2.5.2rc2, here is a typical message, apparently one of 77: ** File dal.py, line 4874, in __main__.test_all Failed example: db.paper.drop() Exception raised: Traceback (most recent call last): File /home/michael/jython2.5.2rc2/Lib/doctest.py, line 1235, in _DocTestRunner__run exec compile(example.source, filename, single, File doctest __main__.test_all[63], line 1, in module db.paper.drop() NameError: name 'db' is not defined ** 2 items had failures: 15 of 15 in __main__ 62 of 64 in __main__.test_all ***Test Failed*** 77 failures. On Dec 8, 9:28 pm, mdipierro mdipie...@cs.depaul.edu wrote: Can you try jython and pypy and do jython dal.py pypy dal.py Please report any error. Massimo
[web2py] Janrain Database Errors
Hey everyone, Thanks for the help on my earlier problems. I am happy to say I am up and hosted. I am currently attempting to run my login through janrain. I uncommented the scaffolding section and I am pleased to announce that apparently Janrain is working. The login button shows a page with the facebook login i have configured. Click on that, it asks for the facebook app to work, then redirects to the page as requested. The error is that it doesn't seem to actually log-in, or rather it doesn't add the new user to the auth_user database. I have attempted creating a new app and redoing the janrain process to test and I have the same result. I then went to the janrain.com and tested their token generation, and the response seems to be working as expected. Any ideas?
[web2py] Re: needs more new dal testers
I think the problem is that it not finding any driver. It is not even defining db. Did the old dal worked with jython. good pypy works for you. It crashes with segmentation fault on me. On Dec 9, 11:17 pm, Michael McGinnis ish...@biographiks.com wrote: I've never used either one before. But no errors on pypy-1.4. For jython-2.5.2rc2, here is a typical message, apparently one of 77: ** File dal.py, line 4874, in __main__.test_all Failed example: db.paper.drop() Exception raised: Traceback (most recent call last): File /home/michael/jython2.5.2rc2/Lib/doctest.py, line 1235, in _DocTestRunner__run exec compile(example.source, filename, single, File doctest __main__.test_all[63], line 1, in module db.paper.drop() NameError: name 'db' is not defined ** 2 items had failures: 15 of 15 in __main__ 62 of 64 in __main__.test_all ***Test Failed*** 77 failures. On Dec 8, 9:28 pm, mdipierro mdipie...@cs.depaul.edu wrote: Can you try jython and pypy and do jython dal.py pypy dal.py Please report any error. Massimo
[web2py] Re: Janrain Database Errors
Found the solution. Apparently it is extremely important for the default auth() login page that the redirect go to said app/default/login page. I had sent it somewhere else and this seems to be the problem. On Dec 10, 12:23 am, RyaneD scadzomb...@gmail.com wrote: Hey everyone, Thanks for the help on my earlier problems. I am happy to say I am up and hosted. I am currently attempting to run my login through janrain. I uncommented the scaffolding section and I am pleased to announce that apparently Janrain is working. The login button shows a page with the facebook login i have configured. Click on that, it asks for the facebook app to work, then redirects to the page as requested. The error is that it doesn't seem to actually log-in, or rather it doesn't add the new user to the auth_user database. I have attempted creating a new app and redoing the janrain process to test and I have the same result. I then went to the janrain.com and tested their token generation, and the response seems to be working as expected. Any ideas?
Re: [web2py] grid
Forget about what I said, DataTables is the best one so far! http://www.datatables.net/examples/server_side/server_side.html I am having a good time with this one, all features in one table plugin. This is already in /plugins http://web2py.com/plugins/default/datatable, but need more documentation, recipes, helpers and more attention. -- Bruno Rocha http://about.me/rochacbruno/bio
[web2py] Re: needs more new dal testers
I could run 1.89.5 (2010-11-21 22:12:54) with ./jython web2py/web2py.py (no cron because no file locking, though) just fine on http://127.0.0.1:8000/admin/default/site though I got errors on several other apps including http://127.0.0.1:8000/welcome/default/index: type 'exceptions.RuntimeError'(global name 'sqlite3' is not defined (tried 5 times)) For what it's worth, this is what I get when I try to run the old dal as a standalone file: mich...@doulos:~/jython2.5.2rc2$ ./jython dal.py Traceback (most recent call last): File dal.py, line 51, in module from utils import md5_hash, web2py_uuid ImportError: No module named utils On Dec 9, 11:25 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think the problem is that it not finding any driver. It is not even defining db. Did the old dal worked with jython. good pypy works for you. It crashes with segmentation fault on me. On Dec 9, 11:17 pm, Michael McGinnis ish...@biographiks.com wrote: I've never used either one before. But no errors on pypy-1.4. For jython-2.5.2rc2, here is a typical message, apparently one of 77: ** File dal.py, line 4874, in __main__.test_all Failed example: db.paper.drop() Exception raised: Traceback (most recent call last): File /home/michael/jython2.5.2rc2/Lib/doctest.py, line 1235, in _DocTestRunner__run exec compile(example.source, filename, single, File doctest __main__.test_all[63], line 1, in module db.paper.drop() NameError: name 'db' is not defined ** 2 items had failures: 15 of 15 in __main__ 62 of 64 in __main__.test_all ***Test Failed*** 77 failures. On Dec 8, 9:28 pm, mdipierro mdipie...@cs.depaul.edu wrote: Can you try jython and pypy and do jython dal.py pypy dal.py Please report any error. Massimo
[web2py] Trying to test DAL vs. CouchDB but still getting errors ...
I'm running latest trunk version of web2py and trying using DAL with CouchDB. I'm still getting following error. Traceback (most recent call last): File c:\java\web2py\gluon\main.py, line 488, in wsgibase BaseAdapter.close_all_instances(BaseAdapter.rollback) File c:\java\web2py\gluon\dal.py, line 270, in close_all_instances action(instance) File c:\java\web2py\gluon\dal.py, line 1026, in rollback return self.connection.rollback() AttributeError: 'Server' object has no attribute 'rollback' Is there something I'm missing? David
[web2py] Re: it case you missed it...
On Dec 10, 5:12 am, Bruno Rocha rochacbr...@gmail.com wrote: But, I like the fact DAL is a single file, for me it is better to be a single file, better to maintain and keep my projects updated. I have a PyGTK program running with SQL.py and I will update this to the new dal.py this weekend, I prefer to update a single file. I tend to agree. The issue of whether to use a single field or not rests solely on the degree of inter-dependence of the file contents, not some kind of subjective idea of maximum lines of code.There are source files that are too long at 10 lines (containing multiple disjointed functions) and there are source files that are correctly single-file at 20KLOC (strong inter-dependence). So it depends on the nature of the file contents.