[web2py] Re: Add Appending Fields to a Form with Ajax
Hi! I'm also interested how this works :) best regards Gerd
Re: [web2py] Re: Massimo
Programmers don't get the glory they deserve, http://goo.gl/yRJbR. On Wed, Dec 7, 2011 at 12:34 PM, Vineet vineet.deod...@gmail.com wrote: Oops. Inadvertently, I did not mention about the other contributors in my OP! Anthony's ( of course, the other members') replies have been very useful to me.
[web2py] vCard
I am working on sort of an address book application. The addresses are rendered as a business card in a view: div class=ez-mw mw radius_top style=margin-bottom: 12px; !-- Layout 1 -- div class=ez-wr wr style=margin-bottom: 0px; {{if logo:}} div class=ez-box box style=padding-top: 24px; {{=IMG(_src=URL('static','init/images/logos/%s' % logo.link))}} /div !-- ez-box -- {{pass}} {{if tagline:}} div class=ez-box box style=padding-top: 12px; overflow: hidden; h5{{=tagline.line}}/h5 /div !-- ez-box -- {{pass}} div class=ez-box box style=margin-bottom: 0px; {{if organization:}} h5 style=font-weight: bolder; padding-top: 24px;{{=organization.name}}/h5 {{pass}} /div !-- ez-box -- /div !-- ez-wr -- !-- Module 2B -- div class=ez-wr wr style=margin-top: 0px; div class=ez-fr ez-negml ez-50 div class=ez-box content style=padding-left: 0px; overflow: hidden; {{if npas:}} table style=text-align: left; {{for npa in npas:}} {{c=npa.NpaType.abbr}} {{a=npa.Npa.address}} {{if c=='T' or c=='F' or c=='M':}} tr td{{=c}}: /td td{{=a}}/td /tr {{elif c=='E':}} tr td{{=c}}: /td td{{=A(a,_href=mailto:+a)}}/td /tr {{else:}} tr td{{=c}}: /td td{{=A(a,_href=http://+a)}}/td /tr {{pass}} {{pass}} /table {{pass}} /div !-- ez-box -- /div !-- ez-fr -- div class=ez-last ez-oh div class=ez-box content style=overflow: hidden; {{if address:}} table style=text-align: left; tr td{{=address.street}} {{=address.houseNumber}} {{if address.houseNumberExtension:}}{{=address.houseNumberExtension}} {{pass}}/td /tr tr td{{=address.zipcode}} {{=address.city}}/td /tr /table {{pass}} /div !-- ez-box -- /div !-- ez-last -- /div !-- ez-wr -- /div !-- ez-mw -- I would like to add a link to this view which makes the business card downloadable as a vCard. Has anyone done this in web2py? What do I need to do to make this possible? Kind regards, Annet.
[web2py] Re: Massimo
My compliments as well to both Massimo and all contributors. Keep up the good work guys! Thodoris On Dec 7, 9:08 am, chandrakant kumar k.03chan...@gmail.com wrote: Programmers don't get the glory they deserve,http://goo.gl/yRJbR. On Wed, Dec 7, 2011 at 12:34 PM, Vineet vineet.deod...@gmail.com wrote: Oops. Inadvertently, I did not mention about the other contributors in my OP! Anthony's ( of course, the other members') replies have been very useful to me.
Re: [web2py] Re: Massimo
Yep, Anthony is a great teacher, his responds are very detailed and careful, sometimes I would tell newbies go read the book, but he has patience to respond or to point to a good answer
Re: [web2py] Re: Massimo
Am not sure where Yarko is now-a-days, but he used to provide replies in a manner that not only provided answers you were looking for but made you rethink the problem itself. I have his replies stored. Anthony is active both here and in stackoverflow. I can't even keep up here. And one time, Massimo replied for one of the queries, I don't want to beat django, I want to beat IBM consulting. Man...thats vision. I hope this community not only brings out a fantastic framework but practical business model too. Regards, Joseph
[web2py] Re: Massimo
Big thanks to Anthony, Bruno and other contributors for helping newbies like me understand how web2py works better! On Dec 7, 9:33 am, villas villa...@gmail.com wrote: You are right, this list must be one of the very best, and in addition to Massimo, there are some other great contributors. Amongst the many valuable messages that I read here, I wonder whether I might also single out Anthony's posts too - his answers to everyone's questions are really so helpful and well written. Thanks guys!
Re: [web2py] Re: connection with oracle database [SOLVED]
Thanks so Much Laz and Mas i was able to run the source from python 27 install and everything is fine now you guys are the best please how soon are we gon move web2py source to python version 3 ... just asking ... On 12/6/11, tOlorun omnioto...@gmail.com wrote: When i import cx_Oracle from python shell everything is fine its works well ... I tried running from source but i kept getting errors method 1 - C:\Users\Administratorpython C:\Users\Administrator\Downloads\web2py_src\web2py\web2py.py Traceback (most recent call last): File C:\Users\Administrator\Downloads\web2py_src\web2py\web2py.py, line 16, in module import gluon.widget File C:\Users\Administrator\Downloads\web2py_src\web2py\gluon\__init__.py, line 15, in module from globals import current ImportError: No module named globals C:\Users\Administrator method 2 - kindly find attached screenshot E:\tOlorun\tO\web2pypython web2py.py Access is denied. method 3 - E:\tOlorun\tO\web2pye:\Python32\python web2py.py Traceback (most recent call last): File web2py.py, line 16, in module import gluon.widget File E:\tOlorun\tO\web2py\gluon\__init__.py, line 15, in module from globals import current ImportError: No module named globals E:\tOlorun\tO\web2py - all of these i ran with and without administrative privileges Thanks On 12/4/11, Massimo Di Pierro massimo.dipie...@gmail.com wrote: First check it is installed correctly. start python (not web2py) and try to import cx_Oracle if that works but it does not work in web2py then web2py is using a different Python version. Make sure you run web2py from source and not the binary, the binary has its own python. On Dec 3, 9:50 am, tOlorun omnioto...@gmail.com wrote: I did try to import the cx_Oracle module but web2py throws an error then i realized that web2py is not seeing the oracle driver installed already so now ... How do i make web2py see and use the oracle driver which is already installed Thanks in advance On 12/2/11, Lazarof lazaro...@gmail.com wrote: If you are working with Oracle google for this - Oracle Apex. On Dec 2, 11:56 pm, tOlorun omnioto...@gmail.com wrote: Thanks i am able to connect python to oracle database but iam talking about connecting using the web2py connection string db = DAL('oracle://schema_name/schema_password@tns_name', pool_size=100) to connect to oracle database thanks On 12/2/11, Lazarof lazaro...@gmail.com wrote: Hi! Have you tried this? export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/ server/ export LD_LIBRARY_PATH=$ORACLE_HOME/lib export PATH=$ORACLE_HOME/bin:$PATH sudo apt-get install python-dev python-setuptools sudo -E easy_install cx_Oracle Test: $ python import cx_Oracle cnxn = cx_Oracle.connect('system/systempasswd@xe') crsr = cnxn.cursor() crsr.execute('SELECT * FROM dual') On Dec 2, 10:26 pm, tOlorun omnioto...@gmail.com wrote: Thanks for the other time ... buh iam back again ... i dont seem to get a hang of connection strings (lols) please kindly help me with the error below ... Traceback (most recent call last): File gluon/restricted.py, line 194, in restricted File E:/tOlorun/web2py/web2py/applications/est8ment/models/db.py, line 13, in module File gluon/dal.py, line 4156, in __init__ RuntimeError: Failure to connect, tried 5 times: 'NoneType' object has no attribute 'connect' thanks in advance -- Oluwaseun Omotosho *Oluwanife@me* To be filled with the life of Christ Jesus and released into our destinies,taking the world for Him. Credit Risk, Card Ins. Services | Research Development | Flex Branch Retail | FASYL Technology Group M: +2348103891218 | M: +2348185780959 | M: +23233487811 | E-mail: omnioto...@gmail.com I omnioto...@live.com omnioto...@gmail.com | omnioto...@yahoo.co.uk omnioto...@gmail.com I URL ; fasylgroup.com I A Member of *fasyl *Technology Group with presence in Mauritius | UK | India | Nigeria | Ghana | Sierra Leone | South Africa | Zimbabwe | Kenya | Cote d’Ivoire *fasyl *is a BMSL Group Company ….powering business drives This email and all content are subject to the following Disclaimer -- Oluwaseun Omotosho *Oluwanife@me* To be filled with the life of Christ Jesus and released into our destinies,taking the world for Him. Credit Risk, Card Ins. Services | Research Development | Flex Branch
[web2py] Two tables and one grid
Hi, I want to use two tables and one grid. For each person (table 1) there could be some rows in table 2. Table 2 should be edited with a grid. If one person is selected from table 1 the name of the person should only be readable in table 2. The id of the selected person should be the default person-id in table 2. I have found the following solution, but it seems to be a little bit complicated to use a function pnr for the id of the person. Any ideas how to make it better? In db.py (simplified): pnr = None db.define_table('person', Field('name'), ) db.define_table('cv', # curriculum vitae Field('person', db.person, writable=False, readable=True, default=lambda: pnr(), represent=lambda v,r: db.person[v].name), Field('status',requires = IS_IN_SET(['student','teacher','something else'])), Field('date','date'), ) In default.py: def editcv(): pr = db(db.person.name=='Smith').select() # or something like this... pnr = lambda:pr.first().id return dict(grid=SQLFORM.grid( query=db.cv.person==pnr(), user_signature=False, )) And just some other question: - How to do it with a smartgrid? - How to use the parameters fields, field_id and constraints of a smartgrid? - Are there any examples? Regards, Martin
Re: [web2py] Two tables and one grid
On 7 December 2011 13:17, Martin Weissenboeck mweis...@gmail.com wrote: I modified your code a little bit. That is not quite what you want but on the condition that you already have records in table 'cv' a person can edit a record without touching the field 'person'. You probably have to define a function to add records to 'cv' and modify the SQLFORM-grid to let the 'add' button refer to that function where the 'person' field will be writable. I don't know hot to change the link in the 'add' button in the grid. Maybe someone else can help. Model: db.define_table('person', Field('name'), format = '%(name)s') db.define_table('cv', # curriculum vitae Field('person', 'reference person'), Field('status',requires = IS_IN_SET(['student','teacher','something else'])), Field('date','date'), ) Controller: def editcv(): query = db.cv.id 0 db.cv.person.writable = False links = [lambda row: A('Add' , _href = URL('default', 'add_cv', args = [row.id]))] return dict(grid=SQLFORM.grid(query, user_signature=False)) Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
[web2py] Plugin suggestions - Raphael + Dracula
Seems easy to use http://www.graphdracula.net/ http://raphaeljs.com/ Best regards
Re: [web2py] Two tables and one grid
Thank you very much. I have found something in chapter 07 of THE BOOK and I will try all proposals. 2011/12/7 Johann Spies johann.sp...@gmail.com On 7 December 2011 13:17, Martin Weissenboeck mweis...@gmail.com wrote: I modified your code a little bit. That is not quite what you want but on the condition that you already have records in table 'cv' a person can edit a record without touching the field 'person'. You probably have to define a function to add records to 'cv' and modify the SQLFORM-grid to let the 'add' button refer to that function where the 'person' field will be writable. I don't know hot to change the link in the 'add' button in the grid. Maybe someone else can help. Model: db.define_table('person', Field('name'), format = '%(name)s') db.define_table('cv', # curriculum vitae Field('person', 'reference person'), Field('status',requires = IS_IN_SET(['student','teacher','something else'])), Field('date','date'), ) Controller: def editcv(): query = db.cv.id 0 db.cv.person.writable = False links = [lambda row: A('Add' , _href = URL('default', 'add_cv', args = [row.id]))] return dict(grid=SQLFORM.grid(query, user_signature=False)) Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- Mit freundlichen Grüßen / With kind regards Martin Weissenböck Gregor-Mendel-Str. 37, 1190 Wien Austria / European Union Tel +43 1 31400 00 Fax +43 1 31400 700
Re: [web2py] Two tables and one grid
You probably have to define a function to add records to 'cv' and modify the SQLFORM-grid to let the 'add' button refer to that function where the 'person' field will be writable. I don't know hot to change the link in the 'add' button in the grid. Maybe someone else can help. You can edit the href of the 'add' button via: grid.element('.web2py_search_actions a')['_href'] = URL(...) Anthony
[web2py] Re: the register form does not checks if a password is entered
Show your auth_user table definition (including any validators on the password field) and the custom register form code. On Tuesday, December 6, 2011 11:48:12 PM UTC-5, Constantine Vasil wrote: I have to make my own register form. When submitting the form without email I get the message: Invalid Email (right behavior). When I enter a valid email address and just hit Enter, the registration is accepted without checking the two password fields - they are empty. What is wrong?
Re: [web2py] Re: connection with oracle database [SOLVED]
please how soon are we gon move web2py source to python version 3 ... That won't happen, as it would break backward compatibility. Though there is this: http://code.google.com/r/reingart-web2py/source/list?name=py3k (see discussion here: https://groups.google.com/d/topic/web2py-developers/9ztv8ecT1Nk/discussion). Anthony
Re: [web2py] Plugin suggestions - Raphael + Dracula
works even on ie, cool
[web2py] Re: Bug : exec_environment vs. Auth
I don't understand why Auth object makes no problems in web2py shell, but has problem in exec_environment. In my case I have used exec_environment to populate mongo database. I don't know if there is better solution, so I have used web2py DAL to create database structure first in SQLite, i have populated SQLite database, and then copied records into MongoDB. I have no problem with previous bug(?). It's easy to remove Auth object from models. However I just want say, that exec_environment is described in web2py book and if somebody want to try it, and has the initial model from Welcome application, this will fail. So it would be nice to look a little to the Auth and improve this behaviour. I understand, that this isn't really important thing. Mirek
[web2py] error gluon/sqlhtml.py?
I think line 1566 of gluon/sqlhtml.py message = error or T('%(nrows)s records found' % dict(nrows=nrows)) should be message = error or T('%(nrows)s records found') % dict(nrows=nrows) Regards, Martin
[web2py] Re: error gluon/sqlhtml.py?
I think it has already been changed in trunk -- can you check it there? On Wednesday, December 7, 2011 9:40:28 AM UTC-5, mweissen wrote: I think line 1566 of gluon/sqlhtml.py message = error or T('%(nrows)s records found' % dict(nrows=nrows)) should be message = error or T('%(nrows)s records found') % dict(nrows=nrows) Regards, Martin
Re: [web2py] Re: connection with oracle database [SOLVED]
Also, see http://lucumr.pocoo.org/2011/12/7/thoughts-on-python3/ On Wednesday, December 7, 2011 9:03:31 AM UTC-5, Anthony wrote: please how soon are we gon move web2py source to python version 3 ... That won't happen, as it would break backward compatibility. Though there is this: http://code.google.com/r/reingart-web2py/source/list?name=py3k (see discussion here: https://groups.google.com/d/topic/web2py-developers/9ztv8ecT1Nk/discussion ). Anthony
[web2py] Re: Automatic logout in Web2py
On Tuesday, December 6, 2011 11:49:42 PM UTC-5, Saurabh S wrote: Hi thanks fir the reply, I wrote that line in db_init.py but that is not working Did you change the setting after defining Auth? What happens if you set auth.settings.long_expiration to 1800 as well? Anthony
[web2py] hidding functionality and DRY
I have found myself doing multiple times in my views: {{if auth.user:}} # checking that a user in logged in and {{if auth.user.id == my_table.author_id:}} # if he is the author of a table entry SHOW SOMETHING ONLY TO THE AUTHOR OF THIS TABLE {{pass}} {{pass}} I am thinking that repeating myself is a bad code practice and i am going to make a function like is_author(auth.user, my_table.author_id) and in the view have {{if is_author(...):}} Could i hear some opinions on that? Also if there are parts of code that appear in multiple views, is it better to make a function that returns html code in order to make the code better???
[web2py] StaticPython!
If you want to make your web2py application completely portable on Linux, Mac OS X and FreeBSD you can use StaticPython: http://code.google.com/p/pts-mini-gpl/wiki/StaticPython From the homepage: StaticPython is a statically linked version of the Python 2.x (currently 2.7.1) and 3.x (currently 3.2) and Stackless Python interpreters and their standard modules for 32-bit (i686, i386, x86) Linux, Mac OS X and FreeBSD systems. It is distributed as single, statically linked 32-bit executable binaries, which contains the Python scripting engine, the interactive interpreter with command editing (readline), the Python debugger (pdb), most standard Python modules (including pure Python modules and C extensions), coroutine support using greenlet and multithreading support. The binary contains both the pure Python modules and the C extensions, so no additional .py or .so files are needed to run it. It also works in a chroot environment. The binary uses uClibc, so it supports username lookups and DNS lookups as well (without NSS). I tested it and it works like a charm! -- Profile: http://www.gild.com/compagnucciangelo Register on Gild: http://www.gild.com/referral/compagnucciangelo
[web2py] Web2py admin Suggestion
Hello, i want to suggest for consideration this improvement The admin page where i see my models, controlers and views could be more inteligent. The links are ordered alphabeticaly but this causes everyone to scrool all the time to the link of the view or controller named to the end of the alphabet. For me it would be more productive if this admin page could add in every topic( models,controlers,view) the most views links at the top Does it make sense? Thank you
[web2py] Re: hidding functionality and DRY
In general that seems fine. Note, in this case, you can also simplify to: {{if auth.user_id == mytable.author_id:}} This is because auth.user_id returns the id of the current logged in user or None if the user isn't logged in. Of course, this assumes mytable.author_id is never None -- if it is, you would need: {{if auth.user and auth.user.id == mytable.author_id:}} Anthony On Wednesday, December 7, 2011 11:33:44 AM UTC-5, thodoris wrote: I have found myself doing multiple times in my views: {{if auth.user:}} # checking that a user in logged in and {{if auth.user.id == my_table.author_id:}} # if he is the author of a table entry SHOW SOMETHING ONLY TO THE AUTHOR OF THIS TABLE {{pass}} {{pass}} I am thinking that repeating myself is a bad code practice and i am going to make a function like is_author(auth.user, my_table.author_id) and in the view have {{if is_author(...):}} Could i hear some opinions on that? Also if there are parts of code that appear in multiple views, is it better to make a function that returns html code in order to make the code better???
[web2py] Re: StaticPython!
Great find Angelo! Would things like Cython and other CPython extensions (.so) work with StaticPython (obviously they would need to be built for the platform)?
[web2py] Re: Add Appending Fields to a Form with Ajax
Don't use a form for the list items, just for the list header. The following is meant to serve as an example, not as working code. It represents the way I solved the problem. No doubt there are better ways but this does work. The script is Jquery. Strongly recommend you do lots of reading on that site. Also see The Book on javascript and ajax recipes. You can probably accomplish the same thing using a component and the LOAD command; The Book recommends this approach though I have not used it. Validate request.vars in the javascript callbacks!! model: db.define_table('stuff', Field('name')) db.define_table('related', Field('myfield'), Field('stuff_id', db.stuff)) # other details left out controller: def edit(): ## so you can edit stuff form = SQLFORM(db.stuff, request.args[-1]) # if form.process().success: redirect(URFL('edit')) # so you come back here ## outside the form new_related = INPUT(_type='text', _class='new_related_item', _name='this', _id='that') show_related_rows = make_related_rows(request.args[-1] return dict(form=form, new_related=new_related, show_related_rows=show_related_rows) def make_related_rows(id) related_rows = db(db.related.stuff_id==request.args[-1])select() if len(related_rows) == 0: return 'Nothing related to stuff' tbl = TABLE(TR(TH('Related'))) for row in related_rows: tbl.append(TR( INPUT(_type='text', _class='related_input', _id = str(row.id) _name = str(row.id) ) return tbl def new_related(): # here will be your code to parse request.vars.name, # and request.vars.field_id # and insert stuff in the database # hint: use validate_and_insert # make sure field_id is an integer # rebuild the show_related_rows variable # return it return '$('#related_rows').html(show_related_rows) def edit_related(): # parse request.vars and update the affected record # use validate_and_update view {{=form}} {{=new_related}} div id=related_rows {{=show_related_rows}} /div input type=hidden, name=updated_related_text, id=updated_related_text input type=hidden, name=field_id, id=field_id script $('.new_related_item').live('change', function(e){ ajax(URL('new_related', ['this'], ':eval'),); //check out ajax recipes in The Book }); $('.related_input').live('change', function(e){ $('updated_related_text').val(this.val) $('field_id').val(this.id) ajax(URL('edit_related'), [this.name, 'field_id' ], ':eval'); }); /script On Dec 5, 10:56 pm, Aaron Levin vile...@gmail.com wrote: Hi, I'm really enjoying the simplicity of Web2py. However, for the life of me, I cannot figure out a way to accomplish this without re-writing FORM/SQLFORM. So, I know I'm not understanding something :) I'm writing a small app to make lists. Each list has many items. I'd like a user to be able to create a List, and the list may have as many items as needed. When the user creates a list, there is a form field for one item. When they focus or blur or interact with that item field, another one appears below, via ajax. They continue to add items until they're finished. What I cannot figure out is how to pass back the additional form field via ajax, or how to select (via ajax) the form itself. Here is my model: db.define_table('listy', Field('title'), Field('description','text'), Field('created_on','datetime',default=request.now), Field('created_by',db.auth_user, default=auth.user_id), format='%(title)s') db.define_table('entry', Field('listy_id',db.listy), Field('item','string', length=144)) And my basic controller stuff to create a list: @auth.requires_login() def create(): create a new empty list # form = crud.create(db.listy, next=URL('index')) form = SQLFORM.factory(db.listy, db.entry,formstyle='divs') if form.process().accepted: id = db.listy.insert(**db.listy._filter_fields(form.vars)) form.vars.listy=id id = db.entry.insert(**db.entry._filter_fields(form.vars)) response.flash = 'Success! Thanks!' return dict(form=form) Any help is appreciated. Thanks so much!
[web2py] Re: web2py social gathering in Chicago
Chicago too far away! Next time how about Atlanta? Weather (usually) better in the winter. On Dec 6, 6:21 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: If you can make it please RSVP http://mdp.cti.depaul.edu/rsvp/default/respond_event/4bf55e15-0c58-44... Massimo
[web2py] avoid logging-in-site
Hi, From my controller file: @auth.requires_login() def create(): ... def somethingelse(): ... When the user isn't logged in but tries to open the site create.html, then he's redirected to the logging-in-site. My problem is that I'd like the user to be redirected to somethingelse.html instead of the logging-in-site. How to code that? Thanks in advance for help
[web2py] Re: avoid logging-in-site
What do you mean by logging-in-site -- are you just talking about the default login URL (i.e., /default/user/login)? You can set the login URL via: auth.settings.login_url = URL(...) See http://web2py.com/book/default/chapter/08#Settings-and-Messages. Anthony On Wednesday, December 7, 2011 2:02:34 PM UTC-5, Rick wrote: Hi, From my controller file: @auth.requires_login() def create(): ... def somethingelse(): ... When the user isn't logged in but tries to open the site create.html, then he's redirected to the logging-in-site. My problem is that I'd like the user to be redirected to somethingelse.html instead of the logging-in-site. How to code that? Thanks in advance for help
[web2py] Re: web2py social gathering in Chicago
Janrain signin doesn't seem to be working. On Tuesday, December 6, 2011 6:21:44 PM UTC-5, Massimo Di Pierro wrote: If you can make it please RSVP http://mdp.cti.depaul.edu/rsvp/default/respond_event/4bf55e15-0c58-440d-bd61-3dcb99fc8cce Massimo
[web2py] SQLFORM.grid - get rid of 'id'
How can I get rid of the id-column when editing one row of a grid? Regards, Martin
[web2py] Re: SQLFORM.grid - get rid of 'id'
db.mytable.id.readable = db.mytable.id.writeable = False On Wednesday, December 7, 2011 4:23:23 PM UTC-5, mweissen wrote: How can I get rid of the id-column when editing one row of a grid? Regards, Martin
[web2py] Re: How to do it: Handling import path manipulation + GAE + deferred?
Constantine, perhaps because i was not able to untangle the deferred library and paths and how to get GAE and web2py to play nice together (i remember it was a long afternoon a couple of years ago and that is about all), i found http://code.google.com/appengine/docs/python/taskqueue/functions.html which allows me to add a request to the taskqueue. now, this is different then deferred. i believe deferred is like running a python script/module sometime in the future, whereas the taskqueue is like scheduling a curl request to your server sometime in the future. once i wrapped my head around that and wrapped my script/module into a web2py controller function i was up and running in minutes. that said, have you looked into using taskqueue? what does deferred have that taskqueue does not? perhaps i missed something by giving up on deferred. christian
Re: [web2py] Re: SQLFORM.grid - get rid of 'id'
That's it - thank you! 2011/12/7 Anthony abasta...@gmail.com db.mytable.id.readable = db.mytable.id.writeable = False On Wednesday, December 7, 2011 4:23:23 PM UTC-5, mweissen wrote: How can I get rid of the id-column when editing one row of a grid? Regards, Martin
[web2py] Re: Mongo DB, AMFRPC3 and http 500 errors
I just decided to make copies of the objects. Thanks a lot though! On Nov 12, 10:07 pm, Sathvik Ponangi psath...@gmail.com wrote: I keep getting a RestrictedError for certain kinds of output, especially when I try using modules in my views they are usually hard to trace. I think web2py restricts the kind of things you can output, probably for security reasons... Hope that helped!
[web2py] Re: web2py social gathering in Chicago
I'd love to. On Dec 7, 12:53 pm, Cliff cjk...@gmail.com wrote: Chicago too far away! Next time how about Atlanta? Weather (usually) better in the winter. On Dec 6, 6:21 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: If you can make it please RSVP http://mdp.cti.depaul.edu/rsvp/default/respond_event/4bf55e15-0c58-44... Massimo
[web2py] SQLFORM.factory int() argument must be a string or a number, not 'list' in many-to-many relationship
Hi all I'm new to web2py. I set up a many to many relationship like these ones: db.define_table('users_dictionaries', Field('user_id', db.auth_user, requires = IS_IN_DB(db,'auth_user.id', db.auth_user._format)), Field('dictionary_id', db.dictionary, requires=IS_IN_DB(db,'dictionary.id',db.dictionary._format,multiple=True)), ) db.define_table('users_categories', Field('user_id', db.auth_user, requires = IS_IN_DB(db,'auth_user.id', db.auth_user._format)), Field('category_id', db.category, requires=IS_IN_DB(db,'category.id',db.category._format,multiple=True)) ) in the controller i'm doing: perm_form=SQLFORM.factory(db.users_categories,db.users_dictionaries) if perm_form.process().accepted: form.vars.user=auth_user.id id = db.users_categories.insert(**db.user_categories._filter_fields(perm_form.vars)) id = db.users_dictionaries.insert(**db.user_dictionaries._filter_fields(perm_form.vars)) response.flash='Thanks for filling the form' It's displayed correctly: combo for the user, multiple select for user_categories and user_dictionaries but when i try to select a user, some or one category and some or one dictionary and i press submit i get this error: Traceback(most recent call last): File/var/www/argomenti.in/web2py/gluon/restricted.py,line194,inrestricted execccodeinenvironment File/var/www/argomenti.in/web2py/applications/webkeywords2/controllers/admin.py http://localhost:8000/admin/default/edit/webkeywords2/controllers/admin.py,line20,inmodule File/var/www/argomenti.in/web2py/gluon/globals.py,line149,inlambda self._caller=lambdaf:f() File/var/www/argomenti.in/web2py/applications/webkeywords2/controllers/admin.py http://localhost:8000/admin/default/edit/webkeywords2/controllers/admin.py,line9,inindex ifperm_form.process().accepted: File/var/www/argomenti.in/web2py/gluon/html.py,line1950,inprocess self.validate(**kwargs) File/var/www/argomenti.in/web2py/gluon/html.py,line1898,invalidate if self.accepts(**kwargs): File/var/www/argomenti.in/web2py/gluon/sqlhtml.py,line1219,inaccepts fields[fieldname] =safe_int(value) File/var/www/argomenti.in/web2py/gluon/sqlhtml.py,line48,insafe_int returnint(x) TypeError:int()argument must be a stringora number,not'list' How can i fix it? is that multiple=True of my tables that triggers the problem? Thanks -- Vincenzo Ampolo http://vincenzo-ampolo.net http://goshawknest.wordpress.com
[web2py] Re: SQLFORM.factory int() argument must be a string or a number, not 'list' in many-to-many relationship
On Wednesday, December 7, 2011 6:08:24 PM UTC-5, Vincenzo Ampolo wrote: Hi all I'm new to web2py. I set up a many to many relationship like these ones: db.define_table('users_dictionaries', Field('user_id', db.auth_user, requires = IS_IN_DB(db,'auth_user.id', db.auth_user._format)), Field('dictionary_id', db.dictionary, requires=IS_IN_DB(db,'dictionary.id',db.dictionary._format,multiple=True)), ) db.define_table('users_categories', Field('user_id', db.auth_user, requires = IS_IN_DB(db,'auth_user.id', db.auth_user._format)), Field('category_id', db.category, requires=IS_IN_DB(db,'category.id',db.category._format,multiple=True)) ) You only use multiple=True if the field is of type list:reference, which enables it to store multiple reference values in a single field (I'm not sure that's what you want, though). If you want a true many-to-many relationship with a separate record in the link table for each user/dictionary and user/category combo, then do not set multiple=True (in that case, though, you'll only be able to select one dictionary or category at a time). Anthony
Re: [web2py] Re: SQLFORM.factory int() argument must be a string or a number, not 'list' in many-to-many relationship
On 12/08/2011 12:24 AM, Anthony wrote: do not set multiple=True (in that case, though, you'll only be able to select one dictionary or category at a time). Sure, i did it... but i want a form in which the user can choose many an user, many categories and many dictionaries. and submit. how can i do that? -- Vincenzo Ampolo http://vincenzo-ampolo.net http://goshawknest.wordpress.com
Re: [web2py] Web2py breaks with [IS_INT_IN_RANGE(), IS_IN_SET()]
On Tue, Dec 6, 2011 at 8:30 PM, Anthony Bastardi abasta...@gmail.com wrote: Try just using IS_IN_SET as you have, and just do the insert without any transformation -- does that work? Yes.
Re: [web2py] Web2py breaks with [IS_INT_IN_RANGE(), IS_IN_SET()]
Good to know -- I'll make sure the book gets updated. On Wednesday, December 7, 2011 7:12:47 PM UTC-5, viniciusban wrote: On Tue, Dec 6, 2011 at 8:30 PM, Anthony Bastardi abas...@gmail.com wrote: Try just using IS_IN_SET as you have, and just do the insert without any transformation -- does that work? Yes.
Re: [web2py] Web2py breaks with [IS_INT_IN_RANGE(), IS_IN_SET()]
Thanks, Anthony. On Wed, Dec 7, 2011 at 10:15 PM, Anthony abasta...@gmail.com wrote: Good to know -- I'll make sure the book gets updated. On Wednesday, December 7, 2011 7:12:47 PM UTC-5, viniciusban wrote: On Tue, Dec 6, 2011 at 8:30 PM, Anthony Bastardi abas...@gmail.com wrote: Try just using IS_IN_SET as you have, and just do the insert without any transformation -- does that work? Yes.
Re: [web2py] How to implement a function to choose from a really long list of categories?
A bit of curiosity... if web2py component has problems, why couldn't it be replaced (by default) by plugin_suggest_widget if it is open source? On Tue, Nov 29, 2011 at 3:33 PM, Jim Steil j...@qlf.com wrote: +1 for the suggest widget. I too have had display issues with the web2py autocomplete widget. -Jim On 11/29/2011 11:10 AM, Bruno Rocha wrote: http://dev.s-cubism.com/plugin_suggest_widget http://dev.s-cubism.com/plugin_lazy_options_widget On Tue, Nov 29, 2011 at 3:02 PM, Constantine Vasil thst...@gmail.com wrote: I have a long list of categories which the user has to add to his My Info. The issue is the list is very long - about 500 categories and counting. How it would be the best approach to make this list to load in the HTML really quick? Loading this long list takes considerable time especially on mobile devices where the browser is slow. -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: Code changes are not noticed
Anthony, With renewed confidence after your thoughtful reply I created a new directory and my 10 line program worked and behaved perfectly. I believe all your diagnosis is correct and I was simply befuddled. Thank you for helping me over my initial frustration. The power of these 10 lines of code demonstrates web2py will be a great tool in accomplishing my tasks. Sally On Dec 6, 9:33 pm, Anthony abasta...@gmail.com wrote: after I removed the content of the default index.html and added my own 5 lines, I got complaints about (non-existent) line 84. When there is an error in a view file, the line number reported is not the line number of the original view file, but the line number of the code after the entire view has been translated to Python. The translated code is the code shown in the error ticket page, so the line number should match up there. This is mentioned here:http://web2py.com/book/default/chapter/03#errors. When I moved my index.html to index.html.hold, I got complaints about the content of the now absent file. When a function is called and there is no corresponding view file, if generic views are enabled (which they are by default in the 'welcome' app for local requests), web2py will use the generic view -- so even if you have removed index.html, it will still render whatever is returned by your index function. Perhaps that is what is happening here. If you show some code and tracebacks, we might be able to help further. Anthony
[web2py] Re: Code changes are not noticed
Glad to be of help. :-) On Wednesday, December 7, 2011 8:25:19 PM UTC-5, SallyG wrote: Anthony, With renewed confidence after your thoughtful reply I created a new directory and my 10 line program worked and behaved perfectly. I believe all your diagnosis is correct and I was simply befuddled. Thank you for helping me over my initial frustration. The power of these 10 lines of code demonstrates web2py will be a great tool in accomplishing my tasks. Sally On Dec 6, 9:33 pm, Anthony abas...@gmail.com wrote: after I removed the content of the default index.html and added my own 5 lines, I got complaints about (non-existent) line 84. When there is an error in a view file, the line number reported is not the line number of the original view file, but the line number of the code after the entire view has been translated to Python. The translated code is the code shown in the error ticket page, so the line number should match up there. This is mentioned here:http://web2py.com/book/default/chapter/03#errors. When I moved my index.html to index.html.hold, I got complaints about the content of the now absent file. When a function is called and there is no corresponding view file, if generic views are enabled (which they are by default in the 'welcome' app for local requests), web2py will use the generic view -- so even if you have removed index.html, it will still render whatever is returned by your index function. Perhaps that is what is happening here. If you show some code and tracebacks, we might be able to help further. Anthony
[web2py] Re: How to do it: Handling import path manipulation + GAE + deferred?
Thank you, I know about it but I am using deferred because I have a lot of tasks ad-hoc from a functions. Using deferred eliminates the need to create a separate url for each task.
[web2py] Re: the register form does not checks if a password is entered
min_length was missing - I had to go to tools to see how to do it. Thank you.
[web2py] request reset password
I implemented request_reset_password in a separate url to have more control on the design. The email comes with the link pointing to: /reset_password. I am clicking on the link and I can change the password but the button showing on reset_password form is Request Reset Password like the button in /request_reset_password. I believe it should be Reset Password. The question is how to change the name of the button. If I use form factory I can define it like this: form = SQLFORM.factory( submit_button = 'Submit' ) But how to change it directly? Thank in advance, --Constantine def request_reset_password(): form=current.app.auth.request_reset_password() form.custom.submit['_data-theme'] = 'e' form.custom.submit['_data-ajax'] = 'false' auth.messages.reset_password = \ 'Click on the link http://' + current.request.env.http_host + \ URL('reset_password') + \ '/%(key)s to reset your password' current.app.auth = auth return dict( form=form ) def reset_password(): form=current.app.auth.reset_password(next=reset_password_next) form.custom.submit['_data-theme'] = 'e' form.custom.submit['_data-ajax'] = 'false' form.custom.submit_button = 'Reset Password' return dict( form=form )
[web2py] Re: request reset password
You're right -- there's one setting for both buttons (auth.messages.password_reset_button), but they should probably be separate. For now, you could add some code changing the setting right before the reset form is created: auth.messages.password_reset_button = 'Reset Password' form = auth.reset_password() return dict(form=form) Anthony On Wednesday, December 7, 2011 10:54:12 PM UTC-5, Constantine Vasil wrote: I implemented request_reset_password in a separate url to have more control on the design. The email comes with the link pointing to: /reset_password. I am clicking on the link and I can change the password but the button showing on reset_password form is Request Reset Password like the button in /request_reset_password. I believe it should be Reset Password. The question is how to change the name of the button. If I use form factory I can define it like this: form = SQLFORM.factory( submit_button = 'Submit' ) But how to change it directly? Thank in advance, --Constantine def request_reset_password(): form=current.app.auth.request_reset_password() form.custom.submit['_data-theme'] = 'e' form.custom.submit['_data-ajax'] = 'false' auth.messages.reset_password = \ 'Click on the link http://' + current.request.env.http_host + \ URL('reset_password') + \ '/%(key)s to reset your password' current.app.auth = auth return dict( form=form ) def reset_password(): form=current.app.auth.reset_password(next=reset_password_next) form.custom.submit['_data-theme'] = 'e' form.custom.submit['_data-ajax'] = 'false' form.custom.submit_button = 'Reset Password' return dict( form=form )
[web2py] Re: request reset password
Yes it worked! Thank you Anthony, you help is much appreciated. ;)
[web2py] Logout if browser is closed
Hi , Is there any way possible to log-out the user if browser in closed ? Please provide suggestions
[web2py] Logout if browser is closed
Hi , Is there any way possible to log-out the user if browser is closed ? Please provide suggestions