Re: [web2py] book 4th edition in PDF
It worked for me. 2011/12/19 Martin Weissenboeck mweis...@gmail.com I am trying. Regards, Martin
Re: [web2py] Re: Solidform: key-error
Dear Kenji, Apologies for the late reply. I was away for a few days. Do you use virtual fields for computing the article_eq and ltitle? No. Here is my model: akb_signature_uuid = db.Table(db, 'akb_signature_uuid', Field('uuid', length = 64, default = lambda:str(uuid.uuid4()), notnull = True, writable = False, readable = False, unique = True, ondelete = 'CASCADE'), Field('created_on', 'datetime', default = request.now, readable = False, writable = False), Field('created_by', db.auth_user, default = auth.user_id, readable = False, writable = False), Field('updated_on', 'datetime', default = request.now, readable = False, writable = False), Field('updated_by', db.auth_user, update = auth.user_id, readable = False, writable = False) ## The following two functions are used to calculate article_eq: def au_cleanup(au): au1 = re.sub(',', '', au.strip()) au2 = re.sub('[ ]+', ' ', au1) return au2.upper() def art_ekw(art): skrywers = set ([]) if art.primaryauthor: skrywers.add (au_cleanup(art.primaryauthor)) if art.authors: for au in art.authors.split(';'): skrywers.add(au_cleanup(au)) if len(skrywers): ekw = 1.0 / len(skrywers) else: ekw = 0 return ekw db.define_table('akb_articles', Field('title'), Field('primaryauthor'), Field('authors', 'text'), Field('rp_author', length = 64, requires = IS_EMPTY_OR(IS_IN_DB(db, 'akb_reprint.uuid', '%(rp_author)s'))), Field('journal', requires = IS_IN_DB(db, 'akb_journal.uuid', '%(title)s')), Field('bib_id'), Field('bib_pages'), Field('doctype'), Field('language'), Field('abstract', 'text'), Field('bib_vol'), Field('bib_date'), Field('url'), Field('pubyear', compute = lambda x: x['bib_date'][-4:]), Field('ut', # isi-unieke rekordnommer requires = IS_EMPTY_OR(IS_NOT_IN_DB(db, 'akb_articles.ut'))), Field('scopus_id', requires = IS_EMPTY_OR(IS_NOT_IN_DB(db, 'akb_articles.scopus_id'))), Field('sabinet_id', requires = IS_EMPTY_OR(IS_NOT_IN_DB(db, 'akb_articles.sabinet_id'))), Field('isap_id', requires = IS_EMPTY_OR(IS_NOT_IN_DB(db, 'akb_articles.isap_id'))), Field('ltitle', compute = lambda x: re.sub('[iI]|[/][iI]|[sS][uU][pbBP]|/[sS][uU][pPbB]|\W', '', x['title'].lower())), Field('article_eq', 'double' , compute = lambda x: art_ekw(x)), akb_signature_uuid, format = '%(title)s' ) If it didn't work, please let me know more details. As I am not using virtualfields, I did not try your suggestion. Thanks for your attention. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] height of selects is narrower than inputs in the new layout
Hi, I like very much the new layout of the 1.99.4 version. But in forms, the selects are narrower than inputs. I think there would be equal.
[web2py] URLs with non english characters causing error in GAE
My app is getting errors when routing custom profile URLs with non- english characters. Here's a sample URL: 2011-12-18 23:07:14.292 /profile/carlos_alvarez%20el %C3%B3segui_9w5Z1HdEW 500 53ms 0kb Mozilla/5.0 (compatible; Googlebot/ 2.1; +http://www.google.com/bot.html) 173.245.56.25 - - [18/Dec/2011:23:07:14 -0800] GET /profile/ carlos_alvarez%20el%C3%B3segui_9w5Z1HdEW HTTP/1.1 500 0 - Mozilla/ 5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) www.cvstash.com ms=54 cpu_ms=23 api_cpu_ms=0 cpm_usd=0.000699 instance=00c61b117c317501895969fe51d900f96cbb1f Here's a sample log: type 'exceptions.UnicodeDecodeError': 'ascii' codec can't decode byte 0xc3 in position 26: ordinal not in range(128) Traceback (most recent call last): File /base/data/home/apps/cvstash/1.354701965012421390/ gaehandler.py, line 110, in main run_wsgi_app(wsgiapp) File /base/python_runtime/python_lib/versions/1/google/appengine/ ext/webapp/util.py, line 98, in run_wsgi_app run_bare_wsgi_app(add_wsgi_middleware(application)) File /base/python_runtime/python_lib/versions/1/google/appengine/ ext/webapp/util.py, line 118, in run_bare_wsgi_app for data in result: File /base/python_runtime/python_lib/versions/1/google/appengine/ ext/appstats/recording.py, line 926, in appstats_wsgi_wrapper result = app(environ, appstats_start_response) File /base/data/home/apps/cvstash/1.354701965012421390/ gaehandler.py, line 88, in wsgiapp env['PATH_INFO'] = env['PATH_INFO'].encode('utf8') It seems that the error is coming from gaehandler.py. Any ideas to get around this?
[web2py] Re: SQLForm.grid - How do I use it properly?
Hi All, I was just wondering if I can use the row.id or any information with sqlform.grid - Below is the link I have defined to show a button called Send Request. I have re-directed it to use a custom function regstatus that passes a row.id argument. ---code--- links = [lambda row: A(SPAN(_class='icon plus'),'Send Request',_class='positive button',_href=URL(default,reqstatus,args=[row.id]))] --- I want to know how can I use the row.id (in above - args=[row.id]) value and use it to make queries - Example- I would like to send some request to the record (row id) on which I am say a friend request etc. How can I achieve it? Secondly - The button added via link is visible to me on the view as well. Example if I view the record with row.id==1 it shows the Send Request button on this view page as well. Can we hide it? Thanks, Rahul D (www.flockbird.com - web2py powered) On Dec 5, 6:55 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: It odes not work that way. It will translate the string before the substitution: python web2py.py -S welcome -M -N T.force('it') import os print os.path.getsize('applications/welcome/languages/it.py') 4833 T('%(test)s') % dict(test=1) '1' print os.path.getsize('applications/welcome/languages/it.py') 4857 T('%(test)s') % dict(test=2) '2' print os.path.getsize('applications/welcome/languages/it.py') 4857 T('%(test)s') % dict(test=3) '3' print os.path.getsize('applications/welcome/languages/it.py') 4857 as you can see the file size only grows the first time then it does not grow any more. On Dec 4, 6:43 pm, Pepe Araya pepea...@gmail.com wrote: Thanks! Massimo, I noticed that this line of *gluon/sqlhtml.py* 1754: message = error or T('%(nrows)s records found') % dict(nrows=nrows) add a new entry in the language file for every different search result. (1 records found, 2 records found ) I think that %(nrows)s should be outside the T() helper. regards! pepe.
Re: [web2py] Re: Logout if browser is closed
Hi, This code works fine on Firefox (on refresh, on changing url in address bar AND on closing browser) html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleTest LogOut/title script type=text/javascript function OutPopup(){ window.open('page2.html', 'My LogOut Popoup'); // the folowing alert will prove that the function executed alert(I am OutPopup); } /script /head body onunload=javascript: OutPopup() lets go out of a href=# onclick=javascript: OutPopup() here/a /body /html
Re: [web2py] book 4th edition in PDF
Worked AMEX :) Quick question... how can download it if I lost my link after the payment? Regards, Tito On Mon, Dec 19, 2011 at 6:00 AM, Martin Weissenboeck mweis...@gmail.comwrote: It worked for me. 2011/12/19 Martin Weissenboeck mweis...@gmail.com I am trying. Regards, Martin -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
[web2py] Re: SQLForm.grid - How do I use it properly?
Hi All, Also, to add to above questions - How can we hide the query button on the search area in sqlform.grid. And if its possible to hide clear button as well!! Thanks, Rahul D (www.flockbird.com - web2py powered) - On Dec 19, 3:06 pm, Rahul rahul.dhak...@gmail.com wrote: Hi All, I was just wondering if I can use the row.id or any information withsqlform.grid- Below is the link I have defined to show a button called Send Request. I have re-directed it to use a custom function regstatus that passes a row.id argument. ---code--- links = [lambda row: A(SPAN(_class='icon plus'),'Send Request',_class='positive button',_href=URL(default,reqstatus,args=[row.id]))] --- I want to know how can I use the row.id (in above - args=[row.id]) value and use it to make queries - Example- I would like to send some request to the record (row id) on which I am say a friend request etc. How can I achieve it? Secondly - The button added via link is visible to me on the view as well. Example if I view the record with row.id==1 it shows the Send Request button on this view page as well. Can we hide it? Thanks, Rahul D (www.flockbird.com- web2py powered) On Dec 5, 6:55 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: It odes not work that way. It will translate the string before the substitution: python web2py.py -S welcome -M -N T.force('it') import os print os.path.getsize('applications/welcome/languages/it.py') 4833 T('%(test)s') % dict(test=1) '1' print os.path.getsize('applications/welcome/languages/it.py') 4857 T('%(test)s') % dict(test=2) '2' print os.path.getsize('applications/welcome/languages/it.py') 4857 T('%(test)s') % dict(test=3) '3' print os.path.getsize('applications/welcome/languages/it.py') 4857 as you can see the file size only grows the first time then it does not grow any more. On Dec 4, 6:43 pm, Pepe Araya pepea...@gmail.com wrote: Thanks! Massimo, I noticed that this line of *gluon/sqlhtml.py* 1754: message = error or T('%(nrows)s records found') % dict(nrows=nrows) add a new entry in the language file for every different search result. (1 records found, 2 records found ) I think that %(nrows)s should be outside the T() helper. regards! pepe.
[web2py] Re: book 4th edition in PDF
Is the pdf the same as the printed Lulu version? Interested with the epub version for my ereader though, thank you Massimo
[web2py] Re: Solidform: key-error
Thanks for your details. I found a bug in the plugin, which occurs when using fields with hide properties such as readonly. Then I fixed the bug. Could you test the new version of the plugin?: http://dev.s-cubism.com/plugin_solidform Regards, Kenji On 12月19日, 午後5:51, Johann Spies johann.sp...@gmail.com wrote: Dear Kenji, Apologies for the late reply. I was away for a few days. Do you use virtual fields for computing the article_eq and ltitle? No. Here is my model: akb_signature_uuid = db.Table(db, 'akb_signature_uuid', Field('uuid', length = 64, default = lambda:str(uuid.uuid4()), notnull = True, writable = False, readable = False, unique = True, ondelete = 'CASCADE'), Field('created_on', 'datetime', default = request.now, readable = False, writable = False), Field('created_by', db.auth_user, default = auth.user_id, readable = False, writable = False), Field('updated_on', 'datetime', default = request.now, readable = False, writable = False), Field('updated_by', db.auth_user, update = auth.user_id, readable = False, writable = False) ## The following two functions are used to calculate article_eq: def au_cleanup(au): au1 = re.sub(',', '', au.strip()) au2 = re.sub('[ ]+', ' ', au1) return au2.upper() def art_ekw(art): skrywers = set ([]) if art.primaryauthor: skrywers.add (au_cleanup(art.primaryauthor)) if art.authors: for au in art.authors.split(';'): skrywers.add(au_cleanup(au)) if len(skrywers): ekw = 1.0 / len(skrywers) else: ekw = 0 return ekw db.define_table('akb_articles', Field('title'), Field('primaryauthor'), Field('authors', 'text'), Field('rp_author', length = 64, requires = IS_EMPTY_OR(IS_IN_DB(db, 'akb_reprint.uuid', '%(rp_author)s'))), Field('journal', requires = IS_IN_DB(db, 'akb_journal.uuid', '%(title)s')), Field('bib_id'), Field('bib_pages'), Field('doctype'), Field('language'), Field('abstract', 'text'), Field('bib_vol'), Field('bib_date'), Field('url'), Field('pubyear', compute = lambda x: x['bib_date'][-4:]), Field('ut', # isi-unieke rekordnommer requires = IS_EMPTY_OR(IS_NOT_IN_DB(db, 'akb_articles.ut'))), Field('scopus_id', requires = IS_EMPTY_OR(IS_NOT_IN_DB(db, 'akb_articles.scopus_id'))), Field('sabinet_id', requires = IS_EMPTY_OR(IS_NOT_IN_DB(db, 'akb_articles.sabinet_id'))), Field('isap_id', requires = IS_EMPTY_OR(IS_NOT_IN_DB(db, 'akb_articles.isap_id'))), Field('ltitle', compute = lambda x: re.sub('[iI]|[/][iI]|[sS][uU][pbBP]|/[sS][uU][pPbB]|\W', '', x['title'].lower())), Field('article_eq', 'double' , compute = lambda x: art_ekw(x)), akb_signature_uuid, format = '%(title)s' ) If it didn't work, please let me know more details. As I am not using virtualfields, I did not try your suggestion. Thanks for your attention. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] Re: Log tickets
I think this would be a great addition. The major pro is that you can redirect the information about new tickets to a place where you already have other logging. For instance, we run web2py in apache2 via wsgi, and we already have several apache mods for other things. The sysadmins already know where to look for errors and we already have alarms in place that are triggered by certain messages in the apache error log. However, I do not like the idea of splitting a ticket into multiple log calls. If you like to have it that way you could always add your own log Formatter that does splitting. I would rather see that the ticket info was logged as a single string. Anders
Re: [web2py] Re: SQLForm.grid - How do I use it properly?
On 19 December 2011 13:41, Rahul rahul.dhak...@gmail.com wrote: Also, to add to above questions - How can we hide the query button on the search area in sqlform.grid. And if its possible to hide clear button as well!! Use the argument 'searchable=False' in your grid definition. See http://www.web2py.com/books/default/chapter/29/7?search=searchable Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] Re: height of selects is narrower than inputs in the new layout
Me too. Can you send a web2py.css patch? On Dec 19, 3:12 am, puercoespin jzaragoza.puercoes...@gmail.com wrote: Hi, I like very much the new layout of the 1.99.4 version. But in forms, the selects are narrower than inputs. I think there would be equal.
[web2py] Re: URLs with non english characters causing error in GAE
this is fixed in trunk. On Dec 19, 3:15 am, Arbie Samong phek...@gmail.com wrote: My app is getting errors when routing custom profile URLs with non- english characters. Here's a sample URL: 2011-12-18 23:07:14.292 /profile/carlos_alvarez%20el %C3%B3segui_9w5Z1HdEW 500 53ms 0kb Mozilla/5.0 (compatible; Googlebot/ 2.1; +http://www.google.com/bot.html) 173.245.56.25 - - [18/Dec/2011:23:07:14 -0800] GET /profile/ carlos_alvarez%20el%C3%B3segui_9w5Z1HdEW HTTP/1.1 500 0 - Mozilla/ 5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) www.cvstash.com ms=54 cpu_ms=23 api_cpu_ms=0 cpm_usd=0.000699 instance=00c61b117c317501895969fe51d900f96cbb1f Here's a sample log: type 'exceptions.UnicodeDecodeError': 'ascii' codec can't decode byte 0xc3 in position 26: ordinal not in range(128) Traceback (most recent call last): File /base/data/home/apps/cvstash/1.354701965012421390/ gaehandler.py, line 110, in main run_wsgi_app(wsgiapp) File /base/python_runtime/python_lib/versions/1/google/appengine/ ext/webapp/util.py, line 98, in run_wsgi_app run_bare_wsgi_app(add_wsgi_middleware(application)) File /base/python_runtime/python_lib/versions/1/google/appengine/ ext/webapp/util.py, line 118, in run_bare_wsgi_app for data in result: File /base/python_runtime/python_lib/versions/1/google/appengine/ ext/appstats/recording.py, line 926, in appstats_wsgi_wrapper result = app(environ, appstats_start_response) File /base/data/home/apps/cvstash/1.354701965012421390/ gaehandler.py, line 88, in wsgiapp env['PATH_INFO'] = env['PATH_INFO'].encode('utf8') It seems that the error is coming from gaehandler.py. Any ideas to get around this?
Re: [web2py] Re: SQLForm.grid - How do I use it properly?
On 19 December 2011 12:06, Rahul rahul.dhak...@gmail.com wrote: Hi All, I was just wondering if I can use the row.id or any information with sqlform.grid - Below is the link I have defined to show a button called Send Request. I have re-directed it to use a custom function regstatus that passes a row.id argument. ---code--- links = [lambda row: A(SPAN(_class='icon plus'),'Send Request',_class='positive button',_href=URL(default,reqstatus,args=[row.id' http://row.id))] From earlier email on this list: * * *links = [lambda row: A('Edit',_href=URL(controller,edit, * *args=[update, tablename, a.id])) * *and set editable, deletable, details to False. * *If you use jqueryui then the links are rendered as buttons. * This is what I have used to use my own 'Edit' button: links = [lambda row: A('Edit' , _href = URL('default', 'edit_journal', args = [row.id]))] How can I achieve it? Secondly - The button added via link is visible to me on the view as well. Example if I view the record with row.id==1 it shows the Send Request button on this view page as well. Can we hide it? Did you use 'details=False' when you activated the grid? Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] Re: book 4th edition in PDF
I emailed it to you. On Dec 19, 5:04 am, Tito Garrido titogarr...@gmail.com wrote: Worked AMEX :) Quick question... how can download it if I lost my link after the payment? Regards, Tito On Mon, Dec 19, 2011 at 6:00 AM, Martin Weissenboeck mweis...@gmail.comwrote: It worked for me. 2011/12/19 Martin Weissenboeck mweis...@gmail.com I am trying. Regards, Martin -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
[web2py] Re: book 4th edition in PDF
fascinating... will fix it. On Dec 19, 5:15 am, Khalil KHAMLICHI khamlichi.kha...@gmail.com wrote: javascript title :) w2p_pagetitle.png 113KViewDownload
[web2py] Re: book 4th edition in PDF
it is the same. Will try make an epub version. On Dec 19, 6:43 am, carlo syseng...@gmail.com wrote: Is the pdf the same as the printed Lulu version? Interested with the epub version for my ereader though, thank you Massimo
[web2py] grid search_menu method usability improvement
Change the definition of selectfields (~line 1322 of sqlhtml.py) to selectfields = {T('Choose a field.'):''} As it is now, the first line of the select field dropdown is blank, which does not help the user figure out what to do. The proposed change helps the user figure out what to do.
Re: [web2py] Re: Solidform: key-error
Thanks. I will try it out and let you know. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
Re: [web2py] Re: book 4th edition in PDF
I have the pdf from Lulu for the 3rd edition, can i get a free pdf for the 4th edition? Thank you 2011/12/19 Massimo Di Pierro massimo.dipie...@gmail.com it is the same. Will try make an epub version. On Dec 19, 6:43 am, carlo syseng...@gmail.com wrote: Is the pdf the same as the printed Lulu version? Interested with the epub version for my ereader though, thank you Massimo
[web2py] Remove app name from the urls
Hello I am in process of deploying my web2py app. I need to do remove app name from the urls. So that server.com/controller/function should mean server.com/appname/controller/function . Any clues so how I can edit my routes.py file to achieve the above? Regards Abhishek
[web2py] Re: Combine SQLFORM and SQLFORM.grid?
Surely the grid is just a grid and does not have a submit button? Do you mean that you have a grid linked to a form and you want to refresh it when the form is submitted? On Dec 18, 9:10 pm, Martin Weissenboeck mweis...@gmail.com wrote: Hi, I have one form created with SQLFORM and another form created with SQLFORM.grid. Each form has its own submit-button. Is there a simple way to concatanate these forms to one form, which could be sent with one submit-button? Regards, Martin
[web2py] Re: Combine SQLFORM and SQLFORM.grid?
Martin, There has been discussion about manipulating grid. Search for threads containing form.create() Also perhaps Anthony will chime in. He knows this stuff pretty well. apple, Surely the grid is just a grid and does not have a submit button? SQLFORM.grid is much more than that. http://web2py.com/books/default/chapter/29/7#SQLFORM.grid-and-SQLFORM.smartgrid-(experimental) On Dec 19, 9:48 am, apple simo...@gmail.com wrote: Surely the grid is just a grid and does not have a submit button? Do you mean that you have a grid linked to a form and you want to refresh it when the form is submitted? On Dec 18, 9:10 pm, Martin Weissenboeck mweis...@gmail.com wrote: Hi, I have one form created with SQLFORM and another form created with SQLFORM.grid. Each form has its own submit-button. Is there a simple way to concatanate these forms to one form, which could be sent with one submit-button? Regards, Martin
[web2py] Help
Please...I have some dificult in do this in web2py...as follow db.define_table(cidadao ,Field('CD_CIDADAO',type='id',label='Cidadão(PK)') ,Field('CD_MATRICULA',type='integer',notnull=True,label='Matrícula') ,Field('NM_CIDADAO',type='string',notnull=True,label='Nome') ,format = '%(NM_CIDADAO)s' ,singular = 'cidadao' ,plural = 'cidadaos' ,migrate=False) db.define_table(representante ,Field('ID_REPRESENTANTE',type='id',readable=False) ,Field('ID_CARGOS',type='integer',notnull=True,label='Cargo') ,Field('CD_CIDADAO',type='string',notnull=True,label='Matrícula') ,Field('DT_INCLUSAO',type='datetime',notnull=True,label='Inclusão') ,Field('DT_EXCLUSAO',type='datetime',notnull=False,label='Exclusão') ,Field('CD_TELEFONE',type='string',notnull=True,label='Telefone') ,Field('CD_EMAIL',type='string',notnull=True,label='Email') ,Field('CD_CELULAR',type='string',notnull=False,label='Celular') ,migrate=False) db.representante.CD_CIDADAO.requires = IS_IN_DB(db, 'cidadao.CD_CIDADAO', '%(CD_MATRICULA)s - %(NM_CIDADAO)s') db.representante.ID_CARGOS.requires = IS_IN_DB(db, 'cargos.ID_CARGOS', '%(NOME)s') db.define_table(gtils_representante ,Field('ID',type='id',readable=False) ,Field('ID_GTIL',readable=True,label='GTIL') ,Field('ID_REPRESENTANTE',readable=True,label='Representante') ,Field('DT_INICIO',type='datetime',notnull=True,label='Início') ,Field('DT_TERMINO',type='datetime',notnull=False,label='Término') ,migrate=False) db.gtils_representante.ID_GTIL.requires = IS_IN_DB(db, 'gtils.ID_GTIL', '%(NOME)s') How can i fill ID_REPRESENTANTE but show NM_CIDADAO (table cidadao) once i don't have this field in representante table...?? or how can i put a computed field in 'representant' table filled with the result choice of the CD_CIDADAO. Thanks alot
[web2py] computed field or is_in_db(query...
Please...I have some dificult in do this in web2py...as follow db.define_table(cidadao ,Field('CD_CIDADAO',type='id', label='Cidadão(PK)') ,Field('CD_MATRICULA',type='integer',notnull=True,label='Matrícula') ,Field('NM_CIDADAO',type='string',notnull=True,label='Nome') ,format = '%(NM_CIDADAO)s' ,singular = 'cidadao' ,plural = 'cidadaos' ,migrate=False) db.define_table(representante ,Field('ID_REPRESENTANTE',type='id',readable=False) ,Field('ID_CARGOS',type='integer',notnull=True,label='Cargo') ,Field('CD_CIDADAO',type='string',notnull=True,label='Matrícula') ,Field('DT_INCLUSAO',type='datetime',notnull=True,label='Inclusão') ,Field('DT_EXCLUSAO',type='datetime',notnull=False,label='Exclusão') ,Field('CD_TELEFONE',type='string',notnull=True,label='Telefone') ,Field('CD_EMAIL',type='string',notnull=True,label='Email') ,Field('CD_CELULAR',type='string',notnull=False,label='Celular') ,migrate=False) db.representante.CD_CIDADAO.requires = IS_IN_DB(db, 'cidadao.CD_CIDADAO', '%(CD_MATRICULA)s - %(NM_CIDADAO)s') db.representante.ID_CARGOS.requires = IS_IN_DB(db, 'cargos.ID_CARGOS', '%(NOME)s') db.define_table(gtils_representante ,Field('ID',type='id',readable=False) ,Field('ID_GTIL',readable=True,label='GTIL') ,Field('ID_REPRESENTANTE',readable=True,label='Representante') ,Field('DT_INICIO',type='datetime',notnull=True,label='Início') ,Field('DT_TERMINO',type='datetime',notnull=False,label='Término') ,migrate=False) db.gtils_representante.ID_GTIL.requires = IS_IN_DB(db, 'gtils.ID_GTIL', '%(NOME)s') How can i fill ID_REPRESENTANTE but show NM_CIDADAO (table cidadao) once i don't have this field in representante table...?? or how can i put a computed field in 'representant' table filled with the result choice of the CD_CIDADAO. Thanks alot
Re: [web2py] Re: height of selects is narrower than inputs in the new layout
I have a different style but is something like this: After this https://github.com/dhgamache/Skeleton/blob/master/stylesheets/base.css#L327 add: form select, form input[type=file] { height: 30px; } Also think, you have to make a fix for multiple select: select[multiple=multiple] { height: 150px;} 2011/12/19 Massimo Di Pierro massimo.dipie...@gmail.com Me too. Can you send a web2py.css patch? On Dec 19, 3:12 am, puercoespin jzaragoza.puercoes...@gmail.com wrote: Hi, I like very much the new layout of the 1.99.4 version. But in forms, the selects are narrower than inputs. I think there would be equal. -- http://martin.tecnodoc.com.ar
[web2py] Re: migrate passwords from phpBB
Hi Anthony, I'm using this python module which claims to mimic the encyption used in phpBB: https://github.com/exavolt/python-phpass It seems to be working fine so far. Here are some examples: In [11]: import phpass In [12]: from phpass import PasswordHash In [13]: p = PasswordHash() In [14]: password = 'mypassword' In [15]: hash1 = p.hash_password(password) In [16]: hash2 = p.hash_password(password) In [17]: hash3 = p.hash_password(password) In [18]: hash1 == hash2 Out[18]: False In [19]: hash1 == hash3 Out[19]: False In [20]: hash2 == hash3 Out[20]: False In [22]: p.check_password(password, hash1) Out[22]: True In [23]: p.check_password(password, hash2) Out[23]: True In [24]: p.check_password(password, hash3) Out[24]: True In [25]: wrongHash = p.hash_password('notmypassword') In [26]: p.check_password(password, wrongHash) Out[26]: False With regard to the issue of the hash being different every time, I reckon it is because this algorithm uses a salt (http:// en.wikipedia.org/wiki/Salt_%28cryptography%29). Apparently it is more secure... Regards, John On Dec 16, 4:07 pm, Anthony abasta...@gmail.com wrote: Unfortunately this solution will not work for me as I get a different hash every time I call the hash password function for the same plaintext password. What hash function are you using. If you use the same key, it should always return the same output for a given input.
[web2py] compute=lambda r: don't return all the fields
Hello, I try to use compute to generate a record md5_hash on insert and update, but I discover that compute=lambda r: don't return all the db.table fields why? Thanks Richard
[web2py] Re: Remove app name from the urls
routers = dict( BASE = dict(default_application='myapp'),) On Dec 19, 10:47 pm, Abhishek Gupta abhishekgupta.i...@gmail.com wrote: Hello I am in process of deploying my web2py app. I need to do remove app name from the urls. So that server.com/controller/function should mean server.com/appname/controller/function . Any clues so how I can edit my routes.py file to achieve the above? Regards Abhishek
[web2py] IS_UPPER - Thanks it's a great validator
I just want to express my feeling. We use DB2 for our business critical system and people in Japan asked me to input all the value with upper case because they have some printing issue if there is any small letters.. Oh my god, the validator is there ! and the best part is that it doesn't show any error like Input with Upper case but it simply converts the value to upper case when it's submitted. Thank you !
[web2py] linux/unix control panel application - would be better if built with web2py
http://ajenti.org .. looks interesting. However, would be much more elegant and simpler to extend if built with web2py :D .. another interesting python library/framework for remote sysadmin/ remote execution manager which i just came across is http://saltstack.org/ Looks very useful and more powerful / elegant than say fabric..
Re: [web2py] computed field or is_in_db(query...
I have difficulty to understand your models because they are not in english (sorry about that)... I will try to help anyway... By the way you should put , at the end of your lines like this : Field('CD_CIDADAO',type='**string',notnull=True,label='**Matrícula')*,* instead of : *,*Field('CD_CIDADAO',type='**string',notnull=True,label='**Matrícula') Because python will not understand, maybe web2py does, but it is not a good pratice... You use format =... But you don't use web2py fk fearture so format= can't manage your reprensentation... For example : representante table field : CD_CIDADAO field definition should be : Field('CD_CIDADAO',db.cidadao) So CD_CIDADAO will be of type integer and store the id of the cidadao table... That way web2py should generate a dropbox and use format= of cidadao table to avoid displaying the id of the field that has no meaning for end user... Then you will have to use represente= for CD_CIDADAO field to make sure that on retreiving of the result you not having the id instead of what you want the user to see... db.representante.CD_CIDADAO.represent=lambda id, row: db.cidadao(id).NM_CIDADAO Hope it helps Richard On Mon, Dec 19, 2011 at 10:10 AM, Jose Carlos Junior josec...@gmail.comwrote: Please...I have some dificult in do this in web2py...as follow db.define_table(cidadao ,Field('CD_CIDADAO',type='id', **label='Cidadão(PK)') ,Field('CD_MATRICULA',type='**integer',notnull=True,label='** Matrícula') ,Field('NM_CIDADAO',type='**string',notnull=True,label='**Nome') ,format = '%(NM_CIDADAO)s' ,singular = 'cidadao' ,plural = 'cidadaos' ,migrate=False) db.define_table(**representante ,Field('ID_REPRESENTANTE',**type='id',readable=False) ,Field('ID_CARGOS',type='**integer',notnull=True,label='**Cargo') ,Field('CD_CIDADAO',type='**string',notnull=True,label='**Matrícula') ,Field('DT_INCLUSAO',type='**datetime',notnull=True,label='** Inclusão') ,Field('DT_EXCLUSAO',type='**datetime',notnull=False,label=** 'Exclusão') ,Field('CD_TELEFONE',type='**string',notnull=True,label='**Telefone') ,Field('CD_EMAIL',type='**string',notnull=True,label='**Email') ,Field('CD_CELULAR',type='**string',notnull=False,label='**Celular') ,migrate=False) db.representante.CD_CIDADAO.**requires = IS_IN_DB(db, 'cidadao.CD_CIDADAO', '%(CD_MATRICULA)s - %(NM_CIDADAO)s') db.representante.ID_CARGOS.**requires = IS_IN_DB(db, 'cargos.ID_CARGOS', '%(NOME)s') db.define_table(gtils_**representante ,Field('ID',type='id',**readable=False) ,Field('ID_GTIL',readable=**True,label='GTIL') ,Field('ID_REPRESENTANTE',**readable=True,label='**Representante') ,Field('DT_INICIO',type='**datetime',notnull=True,label='**Início') ,Field('DT_TERMINO',type='**datetime',notnull=False,label=**'Término') ,migrate=False) db.gtils_representante.ID_**GTIL.requires = IS_IN_DB(db, 'gtils.ID_GTIL', '%(NOME)s') How can i fill ID_REPRESENTANTE but show NM_CIDADAO (table cidadao) once i don't have this field in representante table...?? or how can i put a computed field in 'representant' table filled with the result choice of the CD_CIDADAO. Thanks alot
[web2py] automatic logout does not work
I set the auth.settings.expiration time but the user is not automatically logged out after the specified time I have tried setting auth.settings.expiration = 1 in db.py after before calling auth.define_tables()
Re: [web2py] Re: Computed Fields broken by 1.99.2
To me it makes no sens that readable and/or writable = False prevent compute to get all the field present in the table definition... I may completely not understand what writable and readable are for... I know that depend of how they are used (both false) the field will not be present at all into the form and we can't get the field into form.vars... No problem with that... But why compute is not getting the whole fields seems to me pretty strange... Maybe this behavior is to allow compute to silently failed if the improper input is passed (ex.: None) Thanks Richard On Thu, Nov 17, 2011 at 9:25 AM, David Manns dgma...@gmail.com wrote: I have finally figured out the cause of my problem, though not why there was inconsistency in behavior with some computed fields updating and others not. I was putting writable=false and readable=false on the computed fields in my model. I'm not sure why I thought this was correct usage; it makes sense that readable=false might be needed to prevent the field from being displayed in forms, but given that the form won't show the field, writable=false would be unnecessary. It seems that neither writable=false nor readable=false is needed for computed fields, they appear to be automatically not displayed in SQLFORM and CRUD. Readable=false causes no harm but writable=false *MAY* cause the field to not be recomputed on update, though it will be computed on record creation. This behavior is still present in the nightly build. The book could use some clarification in this area! David On Nov 17, 1:50 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I believe this is a bug and it has already been fixed in trunk and nightly build. can you confirm? On Nov 16, 8:23 pm, Anthony abasta...@gmail.com wrote: On Wednesday, November 16, 2011 8:39:54 PM UTC-5, David Manns wrote: This is all very alarming in a framework which boasts of always maintaining backward compatibility - quote taken from the preface of the book. The intention was certainly not to break backward compatibility. If something isn't working the same, it's a bug, not a backward compatibility violation (unless, of course, the original behavior was a bug and was simply being fixed). It's always a good idea to test upgrades before deploying to production, and if you find bugs, report them -- they will usually be fixed very quickly. Even better, test out the nightly builds or trunk from time to time, and report bugs before they make it into stable releases. Anthony
[web2py] Re: deployment problem with mod_wsgi
i think there is somthing wrong with the way i installed mod_wsgi ,, can you please tell me how to install it ??
[web2py] haml and sass
when will we have haml and sass inside web2py? Thank you
[web2py] Re: computed field or is_in_db(query...
OK but i need to call from gtils_representante table the nm_cidadao from cidadao tablethis is my doubt gtils_representante is a n:n relationship between GTIL(not posted) and representante. I believe I have not explained it right the first time...
Re: [web2py] Re: computed field or is_in_db(query...
What about that : db.tab2(db.tab1(id).id).field ?? Richard On Mon, Dec 19, 2011 at 11:42 AM, Jose Carlos Junior josec...@gmail.comwrote: OK but i need to call from gtils_representante table the nm_cidadao from cidadao tablethis is my doubt gtils_representante is a n:n relationship between GTIL(not posted) and representante. I believe I have not explained it right the first time...
[web2py] Re: deployment problem with mod_wsgi
Maybe this helps http://jdoe.asidev.com/2009/02/26/configure-web2py-to-run-behind-apache-with-wsgi-mod_wsgi/
[web2py] typo in book
First sentence of the last paragraph in the preface. 'raked' should be 'ranked'. -Jim
[web2py] Is there any mainstream wysiwyg html editor in web2py world?
Hi folks, I used web2py for years but never have a need to use wysiwyg html editor in my projects. Until recently. Then I surprisingly find no mainstream editor mentioned in web2py world. Of course I can go with any editor I will run into, but before that I just want to hear some suggestion from those been-there-done-that people. Any thoughts, gentlemen? Regards, Ray PS: candidates I found. 1. the plugin_wiki of web2py uses elrte (http://elrte.ru/en), which has most powerful feature I even seen 2. I saw this one in an unfamous web2py app, jhtmlarea. It is lightweight. (http://pietschsoft.com/demo/jHtmlArea/) 3. jwysiwyg mentioned in a web2pyslice http://www.web2pyslices.com/slices/take_slice/54 4. This sounds cool. WYSIWYG editor with integrated image upload Options http://www.web2pyslices.com/main/slices/take_slice/18
[web2py] How to clear cached modules?
I was importing a module from the modules folder, and then ended up deleting it. I've since cleaned the application, but noticed that, while the import statement and module-referencing code was still in my controller, no error was getting thrown. (If I copied the web2py folder and fired up a new instance, I got an error.) Where/how does web2py cache modules, and how can we clear that cache?
[web2py] json with https?
is it possible to load json data in javascript from a https url? thank you António
[web2py] SQLFORM.grid short strings
When doing this the assignee, summary and dependencies columns are trunc [shortened]. How can I prevent this to happen? This is the code: db.buglist.insert(bug_id=bugid,dependencies=deps,sev=severity, prio=priority, assignee=assigned_to, status=bug_status, summary=short_desc) grid = SQLFORM.grid(db.buglist,searchable=False,paginate=0,details=False,deletable=False,create=False,editable=False,user_signature=False) return locals()
[web2py] Re: SQLFORM.grid short strings
It takes a maxtextlength argument -- just set it to a large number. In that case, you might want to change the td CSS so there's a max-width (and maybe a min-width) with white-space set to normal (instead of nowrap, which could lead to very wide columns)/ Anthony On Monday, December 19, 2011 1:57:35 PM UTC-5, Nico Palumbo wrote: When doing this the assignee, summary and dependencies columns are trunc [shortened]. How can I prevent this to happen? This is the code: db.buglist.insert(bug_id=bugid,dependencies=deps,sev=severity, prio=priority, assignee=assigned_to, status=bug_status, summary=short_desc) grid = SQLFORM.grid(db.buglist,searchable=False,paginate=0,details=False,deletable=False,create=False,editable=False,user_signature=False) return locals()
[web2py] Re: Is there any mainstream wysiwyg html editor in web2py world?
It shouldn't be too difficult to use any JS editor with web2py, but here are some web2py specific plugins: https://bitbucket.org/PhreeStyle/web2py_ckeditor/src http://dev.s-cubism.com/plugin_elrte_widget http://dev.s-cubism.com/plugin_managed_html/page1/_managed_html_preview Anthony On Monday, December 19, 2011 1:23:16 PM UTC-5, Ray (a.k.a. Iceberg) wrote: Hi folks, I used web2py for years but never have a need to use wysiwyg html editor in my projects. Until recently. Then I surprisingly find no mainstream editor mentioned in web2py world. Of course I can go with any editor I will run into, but before that I just want to hear some suggestion from those been-there-done-that people. Any thoughts, gentlemen? Regards, Ray PS: candidates I found. 1. the plugin_wiki of web2py uses elrte (http://elrte.ru/en), which has most powerful feature I even seen 2. I saw this one in an unfamous web2py app, jhtmlarea. It is lightweight. (http://pietschsoft.com/demo/jHtmlArea/) 3. jwysiwyg mentioned in a web2pyslice http://www.web2pyslices.com/slices/take_slice/54 4. This sounds cool. WYSIWYG editor with integrated image upload Options http://www.web2pyslices.com/main/slices/take_slice/18
Re: [web2py] compute=lambda r: don't return all the fields
What do you mean it doesn't return all the fields? On Monday, December 19, 2011 10:47:42 AM UTC-5, Richard wrote: Hello, I try to use compute to generate a record md5_hash on insert and update, but I discover that compute=lambda r: don't return all the db.table fields why? Thanks Richard
[web2py] Re: migrate passwords from phpBB
I suppose the salt may be attached to the hashed password, so you may have to pull off the salt, use it to hash the password, then add it to the hash. The .check_password() method probably does that automatically. Maybe you can just use that method directly. Anthony On Monday, December 19, 2011 10:45:17 AM UTC-5, greenguerilla wrote: Hi Anthony, I'm using this python module which claims to mimic the encyption used in phpBB: https://github.com/exavolt/python-phpass It seems to be working fine so far. Here are some examples: In [11]: import phpass In [12]: from phpass import PasswordHash In [13]: p = PasswordHash() In [14]: password = 'mypassword' In [15]: hash1 = p.hash_password(password) In [16]: hash2 = p.hash_password(password) In [17]: hash3 = p.hash_password(password) In [18]: hash1 == hash2 Out[18]: False In [19]: hash1 == hash3 Out[19]: False In [20]: hash2 == hash3 Out[20]: False In [22]: p.check_password(password, hash1) Out[22]: True In [23]: p.check_password(password, hash2) Out[23]: True In [24]: p.check_password(password, hash3) Out[24]: True In [25]: wrongHash = p.hash_password('notmypassword') In [26]: p.check_password(password, wrongHash) Out[26]: False With regard to the issue of the hash being different every time, I reckon it is because this algorithm uses a salt (http:// en.wikipedia.org/wiki/Salt_%28cryptography%29). Apparently it is more secure... Regards, John On Dec 16, 4:07 pm, Anthony abas...@gmail.com wrote: Unfortunately this solution will not work for me as I get a different hash every time I call the hash password function for the same plaintext password. What hash function are you using. If you use the same key, it should always return the same output for a given input.
Re: [web2py] compute=lambda r: don't return all the fields
I don't get all my db.table fields form define_table fields defined... A other guy report that... But didn't find exactly why his compute functions as stop working properly... To me it's related to the fact tha if I do : Field('mycomputefield', compute=lambda r: r) I am not getting all the fields. For example: db.define_table('test1', Field('f1','string'), Field('f2','integer'), Field('computefield',compute=lambda r: r)) Will return only field that appear in form, so if I set f1 to writable=False, it will not be in form so it will not be available to compute function... I think it for make compute failed silently if some fields are set to writable or readable = False... But I would return all the field to compute with a None for empty field instead of not returning any key... I really don't know if it even possible, if it is a bug or something else... I work around issue I were having with compute (I would compute a md5 hash for row so I would have all key/value pairs even if one of those were empty, but I can't with compute), so I use the new virtual field style (hope it will stay). Here the thread I am refering to : http://groups.google.com/group/web2py/browse_thread/thread/cd6191f9827a48d5/a367c0e5055bb676?lnk=gstq=Computed+Fields+broken+by+1.99.2#a367c0e5055bb676 Richard On Mon, Dec 19, 2011 at 2:22 PM, Anthony abasta...@gmail.com wrote: What do you mean it doesn't return all the fields? On Monday, December 19, 2011 10:47:42 AM UTC-5, Richard wrote: Hello, I try to use compute to generate a record md5_hash on insert and update, but I discover that compute=lambda r: don't return all the db.table fields why? Thanks Richard
Re: [web2py] Re: computed field or is_in_db(query...
Carlos, If you really not getting it... Here what I am doing to work around the kind of problem you seem to have... I would make a view at backend level with id and reprensent I want for this particular id, then I write db model for the view like if it was a web2py table and then use this table in my represent instead of the original table that were linked with m2n relation... Hope it helps Richard On Mon, Dec 19, 2011 at 11:54 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: What about that : db.tab2(db.tab1(id).id).field ?? Richard On Mon, Dec 19, 2011 at 11:42 AM, Jose Carlos Junior josec...@gmail.comwrote: OK but i need to call from gtils_representante table the nm_cidadao from cidadao tablethis is my doubt gtils_representante is a n:n relationship between GTIL(not posted) and representante. I believe I have not explained it right the first time...
Re: [web2py] email/password login only: How to change email to lower case at the register page and store as a lower case to the database.
On Monday, December 19, 2011 2:03:36 AM UTC-5, thstart wrote: Thank you - for login it works but for register it does not. In the case of register the validator executes after register and register is telling the email is invalid. Can you show your code?
[web2py] Can't modify SQL table schema with db.define_table?
When I change a table definition in db.define_table, either by dropping a field or changing a field type, the change never seems to take effect in SQL. Old columns and old field types are always retained, even though web2py seems to 'think' they've changed. I'm using SQLite, and run into this issue repeatedly. I've posted specific details on StackOverflow: http://stackoverflow.com/q/8565024/165673
[web2py] Re: Can't modify SQL table schema with db.define_table?
See http://web2py.com/books/default/chapter/29/6#Fixing-broken-migrations for specific issues with SQLite. Anthony
[web2py] Re: assigning class name to SQLform element parent gives error
no one else has encountered same problem?
[web2py] Re: Can't modify SQL table schema with db.define_table?
correct. Because SQLite does not support ALTER TABLE DROP therefore it cannot drop a column from an existing table not even to replace it. It works with the other databases. There is special logic in dal.py to skip this type of migrations in sqlite. Massimo On Dec 19, 2:03 pm, Yarin ykess...@gmail.com wrote: When I change a table definition in db.define_table, either by dropping a field or changing a field type, the change never seems to take effect in SQL. Old columns and old field types are always retained, even though web2py seems to 'think' they've changed. I'm using SQLite, and run into this issue repeatedly. I've posted specific details on StackOverflow:http://stackoverflow.com/q/8565024/165673
[web2py] Re: assigning class name to SQLform element parent gives error
This is strange -- when you submit the form but fail to include the rating, for some reason, the 'parent' attribute of the SELECT element is set to None rather than referring to it's parent TD. Can you submit a ticket about that (you can link to this thread): http://code.google.com/p/web2py/issues/list For now, you can refer to the TD more directly: form.elements('td')[1]['_class'] = 'multi' That identifies the second TD element in the form, which is the one that contains the SELECT (at least in this example). Anthony On Sunday, December 18, 2011 10:39:19 AM UTC-5, Paolo Caruccio wrote: My fault. I omitted to say that the error occurs after some options have been selected and form is submitted leaving empty the text input. Thank you for your consideration. Paolo
[web2py] Re: assigning class name to SQLform element parent gives error
ticket http://code.google.com/p/web2py/issues/detail?id=574 submitted
[web2py] Re: WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking still showing up
Here's what I've got: Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win 32 Type help, copyright, credits or license for more information. import win32con win32con module 'win32con' from 'C:\Python26\lib\site-packages\win32\lib\win32con.pyc' The mystery gets weirder! I opened up an Eclipse PDB session in my web2py app: (Pdb) import win32con (Pdb) win32con module 'win32con' from 'C:\Python26\Lib\site-packages\win32\lib\win32con.pyc' (Pdb) import sys (Pdb) sys.version_info (2, 6, 0, 'final', 0)
[web2py] Re: WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking still showing up
(The first one is from Python started independently, the second from Eclipse and the running instance of my app.)
[web2py] DecimalWidget _class = double
Hi, Just wondering if it's correct that DecimalWidget _class = double (instead of decimal)?. Thanks, Carlos
[web2py] Re: DecimalWidget _class = double
I was wondering the same thing. Massimo? For now, I'm not sure it matters, as I think the only effect of the widget is to apply client-side input validation (which is the same for double and decimal fields). Perhaps there could be a future need to differentiate the two, in which case, maybe we should implement that now. Anthony On Monday, December 19, 2011 4:57:47 PM UTC-5, Carlos wrote: Hi, Just wondering if it's correct that DecimalWidget _class = double (instead of decimal)?. Thanks, Carlos
[web2py] computed field or is_in_db(query...
commas at the beginning of a line is not a common practice, but not necessarily a bad one. I use it myself, having been bitten by too many missing commas too often. ;) On Tuesday, December 20, 2011, Richard Vézina wrote: I have difficulty to understand your models because they are not in english (sorry about that)... I will try to help anyway... By the way you should put , at the end of your lines like this : Field('CD_CIDADAO',type='**string',notnull=True,label='**Matrícula')*,* instead of : *,*Field('CD_CIDADAO',type='**string',notnull=True,label='**Matrícula') Because python will not understand, maybe web2py does, but it is not a good pratice... You use format =... But you don't use web2py fk fearture so format= can't manage your reprensentation... For example : representante table field : CD_CIDADAO field definition should be : Field('CD_CIDADAO',db.cidadao) So CD_CIDADAO will be of type integer and store the id of the cidadao table... That way web2py should generate a dropbox and use format= of cidadao table to avoid displaying the id of the field that has no meaning for end user... Then you will have to use represente= for CD_CIDADAO field to make sure that on retreiving of the result you not having the id instead of what you want the user to see... db.representante.CD_CIDADAO.represent=lambda id, row: db.cidadao(id).NM_CIDADAO Hope it helps Richard On Mon, Dec 19, 2011 at 10:10 AM, Jose Carlos Junior josec...@gmail.comwrote: Please...I have some dificult in do this in web2py...as follow db.define_table(cidadao ,Field('CD_CIDADAO',type='id', **label='Cidadão(PK)') ,Field('CD_MATRICULA',type='**integer',notnull=True,label='** Matrícula') ,Field('NM_CIDADAO',type='**string',notnull=True,label='**Nome') ,format = '%(NM_CIDADAO)s' ,singular = 'cidadao' ,plural = 'cidadaos' ,migrate=False) db.define_table(**representante ,Field('ID_REPRESENTANTE',**type='id',readable=False) ,Field('ID_CARGOS',type='**integer',notnull=True,label='**Cargo') ,Field('CD_CIDADAO',type='**string',notnull=True,label='**Matrícula') ,Field('DT_INCLUSAO',type='**datetime',notnull=True,label='** Inclusão') ,Field('DT_EXCLUSAO',type='**datetime',notnull=False,label=** 'Exclusão') ,Field('CD_TELEFONE',type='**string',notnull=True,label='**Telefone') ,Field('CD_EMAIL',type='**string',notnull=True,label='**Email') ,Field('CD_CELULAR',type='**string',notnull=False,label='**Celular') ,migrate=False) db.representante.CD_CIDADAO.**requires = IS_IN_DB(db, 'cidadao.CD_CIDADAO', '%(CD_MATRICULA)s - %(NM_CIDADAO)s') db.representante.ID_CARGOS.**requires = IS_IN_DB(db, 'cargos.ID_CARGOS', '%(NOME)s') db.define_table(gtils_**representante ,Field('ID',type='id',**readable=False) ,Field('ID_GTIL',readable=**True,label='GTIL') ,Field('ID_REPRESENTANTE',**readable=True,label='**Representante') ,Field('DT_INICIO',type='**datetime',notnull=True,label='**Início') ,Field('DT_TERMINO',type='**datetime',notnull=False,label=** 'Término') ,migrate=False) db.gtils_representante.ID_**GTIL.requires = IS_IN_DB(db, 'gtils.ID_GTIL', '%(NOME)s') How can i fill ID_REPRESENTANTE but show NM_CIDADAO (table cidadao) once i don't have this field in representante table...?? or how can i put a computed field in 'representant' table filled with the result choice of the CD_CIDADAO. Thanks alot
[web2py] Re: deployment problem with mod_wsgi
Installing mod_wsgi on Fedora would be simply (in shell, executed as root): yum install mod_wsgi
[web2py] Re: haml and sass
Curious. I've surprisingly not heard of haml. What would you say are the benefits over web2py's built-in HTML helpers? SASS could be quite helpful for us front-end guys, and I notice there are a couple of python modules out there. My opinion is that I don't know if it would need to be included in the core of web2py, but I wonder how hard a plug-in would be...
[web2py] Re: Can't modify SQL table schema with db.define_table?
OK I understand the SQLite issue, but not the options I have. 1) SQLite does support renaming tables. I renamed the table in question in SQLiteManager, hoping that web2py would then create a new table under the old name. But now web2py simply complains that the old question doesn't exist. Why wouldn't it create a new, empty table? 2) According to the web2py docs, The solution consists in updating all records of the table and updating the values in the column in question with None. This is quite unclear- how does this help? In my situation the column values were already None. I'm afraid I don't understand how to proceed. Is there a work-around short of creating an entirely new database file? On Dec 19, 3:13 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: correct. Because SQLite does not support ALTER TABLE DROP therefore it cannot drop a column from an existing table not even to replace it. It works with the other databases. There is special logic in dal.py to skip this type of migrations in sqlite. Massimo On Dec 19, 2:03 pm, Yarin ykess...@gmail.com wrote: When I change a table definition in db.define_table, either by dropping a field or changing a field type, the change never seems to take effect in SQL. Old columns and old field types are always retained, even though web2py seems to 'think' they've changed. I'm using SQLite, and run into this issue repeatedly. I've posted specific details on StackOverflow:http://stackoverflow.com/q/8565024/165673
[web2py] Re: Can't modify SQL table schema with db.define_table?
OK I understand the SQLite issue, but not the options I have. 1) SQLite does support renaming tables. I renamed the table in question in SQLiteManager, hoping that web2py would then create a new table under the old name. But now web2py simply complains that the old table doesn't exist. Why wouldn't it create a new, empty table? 2) According to the web2py docs, The solution consists in updating all records of the table and updating the values in the column in question with None. This is quite unclear- how does this help? In my situation the column values were already None. I'm afraid I don't understand how to proceed. Is there a work- around short of creating an entirely new database file? On Dec 19, 3:13 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: correct. Because SQLite does not support ALTER TABLE DROP therefore it cannot drop a column from an existing table not even to replace it. It works with the other databases. There is special logic in dal.py to skip this type of migrations in sqlite. Massimo On Dec 19, 2:03 pm, Yarin ykess...@gmail.com wrote: When I change a table definition in db.define_table, either by dropping a field or changing a field type, the change never seems to take effect in SQL. Old columns and old field types are always retained, even though web2py seems to 'think' they've changed. I'm using SQLite, and run into this issue repeatedly. I've posted specific details on StackOverflow:http://stackoverflow.com/q/8565024/165673
[web2py] Re: computed field or is_in_db(query...
Good idea... I gonna try thisas soon as possible Thanks alot... On 19 dez, 17:44, Richard Vézina ml.richard.vez...@gmail.com wrote: Carlos, If you really not getting it... Here what I am doing to work around the kind of problem you seem to have... I would make a view at backend level with id and reprensent I want for this particular id, then I write db model for the view like if it was a web2py table and then use this table in my represent instead of the original table that were linked with m2n relation... Hope it helps Richard On Mon, Dec 19, 2011 at 11:54 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: What about that : db.tab2(db.tab1(id).id).field ?? Richard On Mon, Dec 19, 2011 at 11:42 AM, Jose Carlos Junior josec...@gmail.comwrote: OK but i need to call from gtils_representante table the nm_cidadao from cidadao tablethis is my doubt gtils_representante is a n:n relationship between GTIL(not posted) and representante. I believe I have not explained it right the first time...
[web2py] Has this been Fixed?
http://www.youtube.com/watch?v=5ZLmRMLo6HI We are thinking about moving our site from pyramid to Web2py. Are there still security holes in Web2py as found in the video? -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
[web2py] Re: Has this been Fixed?
Did you read the comments below the video? The comments make it clear that the video is not demonstrating a web2py vulnerability. The creator of the video simply used web2py to create a deliberately vulnerable application. He explicitly avoided using web2py's built-in authentication mechanism, which does not have the demonstrated vulnerability. Here is a quote: *Yes I had to go through unusual mechanisms to create that webapp ;-) I used web2py just because its a great framework.* * * *By default, are [sic] you explain, web2py does not allow you to create such vulnerable code. The demo is not meant to show vulnerabilities in web2py, but rather generic issues found in web applications and how Acunetix WVS can be used to demonstrate these vulnerabilities.* So, you are safe moving your app to web2py. In fact, web2py takes security very seriously and is designed to be highly secure by default -- see http://web2py.com/books/default/chapter/29/1#Security and http://web2py.com/books/default/chapter/29/0. Anthony On Monday, December 19, 2011 8:24:18 PM UTC-5, Detectedstealth wrote: http://www.youtube.com/watch?v=5ZLmRMLo6HI We are thinking about moving our site from pyramid to Web2py. Are there still security holes in Web2py as found in the video? -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
[web2py] Re: haml and sass
I've used HamlPy before: https://github.com/jessemiller/HamlPy. It works really well for those familiar with Python syntax. All you have to do is listen on a directory, or set up an Eclipse job that executes a script every time you save a file. If anyone is interested, I could dig back and find the script I used. On Dec 19, 11:41 am, António Ramos ramstei...@gmail.com wrote: when will we have haml and sass inside web2py? Thank you
Re: [web2py] Re: Has this been Fixed?
Honestly I didn't read the comments, I just seen that video shortly before heading home. I have been using web2py for a while, just had to make sure you never know right? Anyway's thanks for clearing things up. -- Regards, Bruce On Mon, Dec 19, 2011 at 5:46 PM, Anthony abasta...@gmail.com wrote: Did you read the comments below the video? The comments make it clear that the video is not demonstrating a web2py vulnerability. The creator of the video simply used web2py to create a deliberately vulnerable application. He explicitly avoided using web2py's built-in authentication mechanism, which does not have the demonstrated vulnerability. Here is a quote: *Yes I had to go through unusual mechanisms to create that webapp ;-) I used web2py just because its a great framework.* * * *By default, are [sic] you explain, web2py does not allow you to create such vulnerable code. The demo is not meant to show vulnerabilities in web2py, but rather generic issues found in web applications and how Acunetix WVS can be used to demonstrate these vulnerabilities.* So, you are safe moving your app to web2py. In fact, web2py takes security very seriously and is designed to be highly secure by default -- see http://web2py.com/books/default/chapter/29/1#Security and http://web2py.com/books/default/chapter/29/0. Anthony On Monday, December 19, 2011 8:24:18 PM UTC-5, Detectedstealth wrote: http://www.youtube.com/watch?**v=5ZLmRMLo6HIhttp://www.youtube.com/watch?v=5ZLmRMLo6HI We are thinking about moving our site from pyramid to Web2py. Are there still security holes in Web2py as found in the video? -- -- Regards, Bruce Wade http://ca.linkedin.com/in/**brucelwadehttp://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.**fitnessfriendsfinder.comhttp://www.fitnessfriendsfinder.com -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
[web2py] clarification needed: response.files.append()
I am on 1.99.4 stable I tried include some files with response.files.append() 1. outside of layout.html and 2. after {{include 'web2py_ajax.html'}} in layout.html, but they didn't seem to appear in the html, for example: {{response.files.append(URL('static','js/jquery.example.js'))}} Is this expected? I haven't tried this before on previous versions.
[web2py] Re: clarification needed: response.files.append()
Adding to response.files should happen before web2py_ajax.html is included (e.g., in the head of layout.html, or even in the controller or a model file). The reason is that the code that actually includes the files listed in response.files is in web2py_ajax.html. Anthony On Monday, December 19, 2011 11:06:41 PM UTC-5, lyn2py wrote: I am on 1.99.4 stable I tried include some files with response.files.append() 1. outside of layout.html and 2. after {{include 'web2py_ajax.html'}} in layout.html, but they didn't seem to appear in the html, for example: {{response.files.append(URL('static','js/jquery.example.js'))}} Is this expected? I haven't tried this before on previous versions.
[web2py] 'web2py.js' and 'web2py_ajax.js': Which one to use?
Hi, in the lastest version of web2py (can't remember if this is the case for older versions), there are two files that are nearly identical in the default applications (admin, examples, welcome) js folder: 'web2py.js' and 'web2py_ajax.js'. It looks like 'web2py.js' is the newer of the two, should I just discard 'web2py_ajax.js' if my project doesn't depend on it? Or is there some web2py code that needs it? Dan
[web2py] Re: 'web2py.js' and 'web2py_ajax.js': Which one to use?
We just renamed web2py_ajax.js to web2py.js (since it includes some JS code not related to Ajax). The old file is no longer included, but if you just unzipped the new folders over the old, it wouldn't remove the old file. You can delete it. Note, we didn't change the name of web2py_ajax.html in the views folder because that would have created more difficulties with backward compatibility of layout plugins. Anthony On Monday, December 19, 2011 9:41:28 PM UTC-5, danny wrote: Hi, in the lastest version of web2py (can't remember if this is the case for older versions), there are two files that are nearly identical in the default applications (admin, examples, welcome) js folder: 'web2py.js' and 'web2py_ajax.js'. It looks like 'web2py.js' is the newer of the two, should I just discard 'web2py_ajax.js' if my project doesn't depend on it? Or is there some web2py code that needs it? Dan
[web2py] Re: clarification needed: response.files.append()
Thanks for the clarification, Anthony. On Dec 20, 12:17 pm, Anthony abasta...@gmail.com wrote: Adding to response.files should happen before web2py_ajax.html is included (e.g., in the head of layout.html, or even in the controller or a model file). The reason is that the code that actually includes the files listed in response.files is in web2py_ajax.html. Anthony On Monday, December 19, 2011 11:06:41 PM UTC-5, lyn2py wrote: I am on 1.99.4 stable I tried include some files with response.files.append() 1. outside of layout.html and 2. after {{include 'web2py_ajax.html'}} in layout.html, but they didn't seem to appear in the html, for example: {{response.files.append(URL('static','js/jquery.example.js'))}} Is this expected? I haven't tried this before on previous versions.
[web2py] Re: DecimalWidget _class = double
was a bug. fixed in trunk. On Dec 19, 4:01 pm, Anthony abasta...@gmail.com wrote: I was wondering the same thing. Massimo? For now, I'm not sure it matters, as I think the only effect of the widget is to apply client-side input validation (which is the same for double and decimal fields). Perhaps there could be a future need to differentiate the two, in which case, maybe we should implement that now. Anthony On Monday, December 19, 2011 4:57:47 PM UTC-5, Carlos wrote: Hi, Just wondering if it's correct that DecimalWidget _class = double (instead of decimal)?. Thanks, Carlos
[web2py] Re: Can't modify SQL table schema with db.define_table?
Indeed 2 does not help. If you delete or rename a sqlite table and if you are not doing it using web2py (db.table.drop()) then you should tell web2py the table no loger exists. You do this by deleting the databases/ *_tablename.table files On Dec 19, 4:50 pm, Yarin ykess...@gmail.com wrote: OK I understand the SQLite issue, but not the options I have. 1) SQLite does support renaming tables. I renamed the table in question in SQLiteManager, hoping that web2py would then create a new table under the old name. But now web2py simply complains that the old table doesn't exist. Why wouldn't it create a new, empty table? 2) According to the web2py docs, The solution consists in updating all records of the table and updating the values in the column in question with None. This is quite unclear- how does this help? In my situation the column values were already None. I'm afraid I don't understand how to proceed. Is there a work- around short of creating an entirely new database file? On Dec 19, 3:13 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: correct. Because SQLite does not support ALTER TABLE DROP therefore it cannot drop a column from an existing table not even to replace it. It works with the other databases. There is special logic in dal.py to skip this type of migrations in sqlite. Massimo On Dec 19, 2:03 pm, Yarin ykess...@gmail.com wrote: When I change a table definition in db.define_table, either by dropping a field or changing a field type, the change never seems to take effect in SQL. Old columns and old field types are always retained, even though web2py seems to 'think' they've changed. I'm using SQLite, and run into this issue repeatedly. I've posted specific details on StackOverflow:http://stackoverflow.com/q/8565024/165673
[web2py] Re: SQLForm.grid - How do I use it properly?
Hi Johnann, Thanks for getting back on my queries. I just want to remove the query button from the search section ( I had tried searchable=False earlier and it hid the entire search section). Is there a way to hide just the query button as for a public site, I would not like everyone know the details of my table and its fields. But I would like to use the ajax search the dialog box provides. I would try the above suggestion on links and get back :) Thanks, Rahul D (www.flockbird.com - web2py powered) - On Dec 19, 7:22 pm, Johann Spies johann.sp...@gmail.com wrote: On 19 December 2011 12:06, Rahul rahul.dhak...@gmail.com wrote: Hi All, I was just wondering if I can use the row.id or any information with sqlform.grid - Below is the link I have defined to show a button called Send Request. I have re-directed it to use a custom function regstatus that passes a row.id argument. ---code--- links = [lambda row: A(SPAN(_class='icon plus'),'Send Request',_class='positive button',_href=URL(default,reqstatus,args=[row.id' http://row.id))] From earlier email on this list: * * *links = [lambda row: A('Edit',_href=URL(controller,edit, * *args=[update, tablename, a.id])) * *and set editable, deletable, details to False. * *If you use jqueryui then the links are rendered as buttons. * This is what I have used to use my own 'Edit' button: links = [lambda row: A('Edit' , _href = URL('default', 'edit_journal', args = [row.id]))] How can I achieve it? Secondly - The button added via link is visible to me on the view as well. Example if I view the record with row.id==1 it shows the Send Request button on this view page as well. Can we hide it? Did you use 'details=False' when you activated the grid? Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] production site hosting
what are the good options(web hosts) for hosting the production sites? I'm located in India.
[web2py] Re: 'web2py.js' and 'web2py_ajax.js': Which one to use?
Gotcha. Thanks! b On Dec 20, 4:24 am, Anthony abasta...@gmail.com wrote: We just renamed web2py_ajax.js to web2py.js (since it includes some JS code not related to Ajax). The old file is no longer included, but if you just unzipped the new folders over the old, it wouldn't remove the old file. You can delete it. Note, we didn't change the name of web2py_ajax.html in the views folder because that would have created more difficulties with backward compatibility of layout plugins. Anthony On Monday, December 19, 2011 9:41:28 PM UTC-5, danny wrote: Hi, in the lastest version of web2py (can't remember if this is the case for older versions), there are two files that are nearly identical in the default applications (admin, examples, welcome) js folder: 'web2py.js' and 'web2py_ajax.js'. It looks like 'web2py.js' is the newer of the two, should I just discard 'web2py_ajax.js' if my project doesn't depend on it? Or is there some web2py code that needs it? Dan
[web2py] Re: new book now available in HTML (english, japanese, italian)
seems to be a problem with the link parser: transparently for SQLite[sqlitehttp://web2py.com/books/default/reference/29/sqlite ], MySQL[mysql http://web2py.com/books/default/reference/29/mysql]