[web2py] Using list:reference in a model on GAE
I have a question about using list:reference in a model on Google App Engine. Here is my model: http://code.google.com/p/publicradioroadtrip/source/browse/models/db_custom.py?spec=svna7a27f086f9519cd6c133493eed55ffd64f9446c&r=a7a27f086f9519cd6c133493eed55ffd64f9446c#33 I am able to add records to the database just fine. The forms appear appropriately and the many to many relationship appears properly in the form. This all works great with web2py development server. However, afterward, when I attempt to display a record using GAE's dev server I receive the error: KeyError: 'substring' http://pastie.textmate.org/1254588 If I comment out the line stories=db(db.story.roadtrip[roadtrip_id]).select(orderby=db.story.title) in my controller here: http://code.google.com/p/publicradioroadtrip/source/browse/controllers/default.py?spec=svn031e8b25da62640a0f1150cd0e43e1dd86b6c975&r=031e8b25da62640a0f1150cd0e43e1dd86b6c975#122 The error seems to go away. Thank you for any advice or suggestions.
[web2py] logging cannot create a log file when run from web2py
Hi, I would like a web2py script to create a log file, but when run via the "python web2py.py ..." command line, the log file (in this case logging.log) is not being created. Is this a permissions issue with file creation? Here is what I what I am doing: #in cron/log.py import logging logging.basicConfig(filename='logging.log',level=logging.INFO) logging.info('test') #command used to run the above file python web2py.py -M -N -S test -R applications/test/cron/log.py & Thanks. Avik Basu
[web2py] possible to alias a field?
I'm trying to get around the problem of not being able to do a join in the IS_IN_DB(). I've got the following, which I thought was working until I realized that it's using the id field from both tables. Can I alias a field from mol as id? (I don't need the actual id field from mol in this instance.) allplaced = db(db.mol.removed==None).select() Field('machine',db.machine, requires=IS_IN_DB(db(~db.machine.id.belongs(allplaced)), db.machine.id, '%(tag)s')), Open to suggestions of a better way to do this. I found that you can alias tables, but I couldn't make it alias the field as well, unless I just wasn't doing it wrong. -- Andrew Thompson http://aktzero.com/
[web2py] reg:DAL and google datastore
Hi, While DAL is wonderful considering the easy semantics and wonderful portability across all databases. However while working with google datastore , I find it much more productive and flexible to use google's API rather than DAL.Can this be done?
[web2py] Re: web2py arguments syntax
On Oct 27, 5:43 pm, VP wrote: > I saw this marriage between web2py and Flask (a strange one, I'll give > you that)... but I'm thinking web2py might be able to improve its > syntax/convention as follows. > > Here's Flask: > > @app.route('/insertdog///') > def insertdog(name,owner,age): > # other things > > Here's web2py: def insertdog(): name, owner, age = request.args I am unconvinced the other way is better.
[web2py] Re: auth issue in Firefox 3.6.10+ on Mac
I've found the problem. In Firefox there's a setting in Privacy which says "Accept third party cookies". As per the documented behavior here: http://kb.mozillazine.org/Network.cookie.cookieBehavior if that is unchecked, network.cookie.cookieBehavior = 1 and "will allow cookies from the originating server only". This is causing some issues in using the bookmarklet - since the originating server is different, it doesn't allow the application to log in the user, even though he may be logged in another tab. Not sure if this helps anyone, but I'm posting these findings for future reference. On Oct 26, 2:51 pm, Adi wrote: > What information can I dump from web2py to debug this problem? > > -- Aditya > > On Oct 26, 10:16 am, Aditya Sahay wrote: > > > No. This is seconds after logging in. > > > On Tue, Oct 26, 2010 at 12:28 AM, mdipierro wrote: > > > Could it be their session expired? > > > > On Oct 25, 1:05 pm,Adi wrote: > > > > Hi all, > > > > > I've got some users facing this peculiar problem in Radbox. > > > > > Faced in: Mac OS X 10.6.4,Firefox3.6.10 and newer > > > > > Even when they're logged into Radbox, there's this small piece of code > > > > which returns -1. > > > > > > > > > if auth.user: > > > > return auth.user.id > > > > else: > > > > return -1 > > > > - > > > > > The worst part is I'm not able to reproduce the problem at my own end, > > > > in the same OS and browser version where users are facing this issue. > > > > > Now auth.user is None when it is expected to be something. The > > > > question is, what information can I log or dump to debug this problem? > > > > For all we know it could possibly be aFirefoxbug, but not being able > > > > to debug it is really frustrating.
[web2py] Re: Using components breaks javascript?
i think the problem is that only on the first load the $ ('select#conversation_dropdown_text').change(function(){ is executed that means that the change() is only applied to select#conversation_dropdown_text on the initial load on reload you would need to retrigger the change() on the select#conversation_dropdown_text to do that include the script in the LOAD component script = SCRIPT("$ ('select#conversation_dropdown_text').change(function() { alert('meow'); }); ...", _type = "text/javascript") e.g. return {'conversation_dropdown':TAG[''](script, conversation_dropdown)} On Oct 26, 9:18 pm, Luther Goh Lu Feng wrote: > This problem might be related to the one > athttp://groups.google.com/group/web2py/browse_thread/thread/1eead541f5... > > The view console.html has two drop down selects. The 1st dropdown > select (id="worksheet-list") activates loads a component via > javascript when changed. The second dropdown select will trigger an > alert dialog when changed. > > When the page is freshly loaded, the second dropdown works as > expected. After a fresh reload, the 1st dropdown works as expected > too. If the 2nd dropdown is immediately triggered after the 1st > dropdown, the 2nd dropdown fails, ie no dialog box appears. And there > are no errors in the javascript console. > > I did a diff of the source code when the 2nd dropdown was working > after a fresh reload, and when it fails, and found very very small > differences in the source:http://tinypic.com/r/muzcyh/7 > > I hope someone can aid me in explaining the cause of these > observations and help me debug this. Thanks in advance. > > #console.html > > > {{ for wk in worksheets: }} > {{=wk.subject}}: > {{=wk.name}} > {{ pass }} > > > > > $(document).ready(function(){ > > $('select#conversation_dropdown_text').change(function(){ > alert('meow'); > }); > > $('select#worksheet-list').change(function(){ > > web2py_component("/roverus/comment/conversation_dropdown.load/" + $ > ('#worksheet-list').val(),"sidebar-header") > > }); > }) > > > Conversation > > {{ block sidebar-header }} > {{=LOAD('comment', 'conversation_dropdown.load', > args=[request.args[0]], ajax=False)}} > {{ end }} > > > == > > #comment.py > > def conversation_dropdown(): > '''This action returns a dropdown component''' > > # Pull the worksheet requested > w = db.worksheet(request.args(0)) > > # Create the manage the conversation selector dropdown > conversation_dropdown = SQLFORM.factory( > Field('text', label='Select a conversation', > requires=IS_IN_DB(db(db.question.worksheet==w), 'question.id', > 'question.text', orderby='question.id')), _id='conversation_dropdown', > table_name="conversation_dropdown") > > #hide the submit button > submit = conversation_dropdown.element('input',_type='submit') > submit['_style'] = 'display:none;' > > #process form dropdown > if conversation_dropdown.accepts(request.vars, session): > current_conversation = request.vars.text > elif conversation_dropdown.errors: > response.flash = 'Form has errors' > > return {'conversation_dropdown':conversation_dropdown}
[web2py] new features in trunk: detect_record_change
Two changes in trunk: 1) form.accepts(request) is now the same as form.accepts(request.post_vars) 2) before you had three options: form=SQLFORM(table,record) if form.accepts(request): response.flash="record updated" elif form.errors: response.flash="errors in form" else: response.flash="form not submitted" Now you have four options: form=SQLFORM(table,record,detect_record_change=True) if form.accepts(request): response.flash="record updated" elif form.errors: response.flash="errors in form" elif form.record_changed: response.flash="other user has changed record before you did" else: response.flash="form not submitted"
[web2py] Re: Using components breaks javascript?
Thanks for the help selecta. I think your explanation is correct. I have managed to resolve my problem by using .live() method http://api.jquery.com/live/ replacing $('select#conversation_dropdown_text').change(function(){ for $('select#conversation_dropdown_text').live('change',function(){ On Oct 27, 5:14 pm, selecta wrote: > i think the problem is that only on the first load the $ > ('select#conversation_dropdown_text').change(function(){ is executed > that means that the change() is only applied to > select#conversation_dropdown_text on the initial load > on reload you would need to retrigger the change() on the > select#conversation_dropdown_text > to do that include the script in the LOAD component > script = SCRIPT("$ > ('select#conversation_dropdown_text').change(function() > { alert('meow'); }); ...", _type = "text/javascript") > e.g. return {'conversation_dropdown':TAG[''](script, > conversation_dropdown)} > > On Oct 26, 9:18 pm, Luther Goh Lu Feng wrote: > > > > > > > > > This problem might be related to the one > > athttp://groups.google.com/group/web2py/browse_thread/thread/1eead541f5... > > > The view console.html has two drop down selects. The 1st dropdown > > select (id="worksheet-list") activates loads a component via > > javascript when changed. The second dropdown select will trigger an > > alert dialog when changed. > > > When the page is freshly loaded, the second dropdown works as > > expected. After a fresh reload, the 1st dropdown works as expected > > too. If the 2nd dropdown is immediately triggered after the 1st > > dropdown, the 2nd dropdown fails, ie no dialog box appears. And there > > are no errors in the javascript console. > > > I did a diff of the source code when the 2nd dropdown was working > > after a fresh reload, and when it fails, and found very very small > > differences in the source:http://tinypic.com/r/muzcyh/7 > > > I hope someone can aid me in explaining the cause of these > > observations and help me debug this. Thanks in advance. > > > #console.html > > > > > {{ for wk in worksheets: }} > > {{=wk.subject}}: > > {{=wk.name}} > > {{ pass }} > > > > > > > > > $(document).ready(function(){ > > > > $('select#conversation_dropdown_text').change(function(){ > > alert('meow'); > > }); > > > $('select#worksheet-list').change(function(){ > > > > web2py_component("/roverus/comment/conversation_dropdown.load/" + $ > > ('#worksheet-list').val(),"sidebar-header") > > > }); > > }) > > > > > Conversation > > > > {{ block sidebar-header }} > > {{=LOAD('comment', 'conversation_dropdown.load', > > args=[request.args[0]], ajax=False)}} > > {{ end }} > > > > > == > > > #comment.py > > > def conversation_dropdown(): > > '''This action returns a dropdown component''' > > > # Pull the worksheet requested > > w = db.worksheet(request.args(0)) > > > # Create the manage the conversation selector dropdown > > conversation_dropdown = SQLFORM.factory( > > Field('text', label='Select a conversation', > > requires=IS_IN_DB(db(db.question.worksheet==w), 'question.id', > > 'question.text', orderby='question.id')), _id='conversation_dropdown', > > table_name="conversation_dropdown") > > > #hide the submit button > > submit = conversation_dropdown.element('input',_type='submit') > > submit['_style'] = 'display:none;' > > > #process form dropdown > > if conversation_dropdown.accepts(request.vars, session): > > current_conversation = request.vars.text > > elif conversation_dropdown.errors: > > response.flash = 'Form has errors' > > > return {'conversation_dropdown':conversation_dropdown}
[web2py] web2py equivalent of Django's pluralize?
How do you do this in web2py: http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#pluralize Thanks, Mike
[web2py] Re: Best way to represent list:string on the widget side?
I am a bit lost in this thread... if there is a | in the code something is wrong. Make sure you have the latest web2py_ajax.html and there is a default widget for list:string. On Oct 20, 12:12 am, Chris wrote: > I'm trying to make an HTML widget that saves its data as a > list:string. > > Currently I'm using a hidden control and saving data joined by '|', > like 'M|T|W', but that only appears to work in displaying the data, > not when saving the data back to DB. > > How should I render the control so it saves back to DB properly? > > Thanks!
[web2py] Re: wizard: site without authentification
That should be fixed. I would take a patch. On Oct 26, 5:03 pm, Tim Michelsen wrote: > Hello, > I took the auth_user table out of the wizard. > > Still, I am required to register and log in after the app is created. > > Regards, > Timmie
[web2py] Re: Powered by web2py
About Instant Press, instead of testing page make link to my new blog made with instant press about instant press, python and web2py . I am not going to maintain test page in appspot but the blog yes. The link is http://martin.tecnodoc.com.ar/ On Oct 24, 10:44 pm, mdipierro wrote: > If you do, I'll link it. ;-) > > On Oct 24, 8:34 pm, Anthony wrote: > > > > > That was fast. Looks great. > > > If you want to link it from the main site, I'll volunteer to keep it > > up to date. I think prospective users really like to see some > > examples, so we should make them easy to find. > > > Anthony > > > On Oct 24, 7:05 pm, mdipierro wrote: > > > > On Oct 24, 5:26 pm, Anthony wrote: > > > > > A few more ideas for the Poweredby page: > > > > > - When entering the URL for a site, failure to include the "http://"; > > > > results in the link simply not working. To avoid this problem, maybe > > > > include the "http://"; in the URL text box by default (or automatically > > > > prepend "http://"; to any URL submitted without "http://";). > > > > done > > > > > - I think we need a little more vertical space between the name of one > > > > site and the thumbnail of the site below it. As is, once you're in the > > > > middle of the page and can no longer see the top or bottom row for > > > > reference, it's difficult to tell whether the name/link is associated > > > > with the thumbnail above it or below it. > > > > done > > > > > - Is there a reason the Poweredby page doesn't use the same layout as > > > > the new web2py.com site? > > > > I think it looks better on black background. > > > > > - Would be great if we could have a handful of "featured" sites > > > > displayed separately at the top -- there are a few real standouts that > > > > are getting lost in the crowd. > > > > done. Feel free to mark some as featured > > > > > - Of course, now that we've got a great Poweredby list, we need to > > > > link to it from somewhere -- maybe add a link in the right sidebar of > > > > web2py.com (maybe at the top of the list of links, or even as a > > > > separate link just below the book). > > > > I am very skeptical in our ability to keep it up to date. > > > If we can do that, I am happy to link from the main site. > > > > > Anthony > > > > > On Oct 22, 10:58 pm, mdipierro wrote: > > > > > > This was done by the wizard and it is already better than the previous > > > > > one: > > > > > >http://web2py.com/poweredby > > > > > > Has thumbnails. > > > > > > On Oct 22, 8:07 pm, mdipierro wrote: > > > > > > > OK. I have an account... > > > > > > > On Oct 22, 6:19 pm, rochacbruno wrote: > > > > > > > > Thumbalizer has an API , REST and sample code for PHP but we can > > > > > > > fork to Python. > > > > > > > > Enviado via iPhone > > > > > > > > Em 22/10/2010, às 20:59, mdipierro > > > > > > > escreveu: > > > > > > > > > This thread contains lots of really nice sites. Others are > > > > > > > > listed > > > > > > > > here: > > > > > > > > >http://web2py.com/poweredby > > > > > > > > > If one of you had some spare time were to send me screenshots > > > > > > > > scaled > > > > > > > > 200x150 nameswww.domain.com.pngetcforallweb2pypoweredsites, I > > > > > > > > would use the template ofhttp://web2py.comandmakeaniceshowroom > > > > > > > > with an ajax gallery. > > > > > > > > > Massimo > > > > > > > > > On Oct 22, 4:50 pm, Anthony wrote: > > > > > > > >> Very cool. Though it has some major display problems in IE7 > > > > > > > >> (and some > > > > > > > >> minor problems with the home page in IE8). Also, you should > > > > > > > >> probably > > > > > > > >> change the site's favicon -- it's actually using the new web2py > > > > > > > >> favicon. > > > > > > > > >> Anthony > > > > > > > > >> On Oct 22, 5:24 pm, Bruno Rocha wrote: > > > > > > > > >>> One more Brazilian site developed with WEB2PY > > > > > > > > >>>http://campus.visie.com.br/default/index > > > > > > > > >>> This is the site where one of the most importants creative > > > > > > > >>> design agency of > > > > > > > >>> São Paulo are giving online courses, they used web2py and > > > > > > > >>> Amazon with boto > > > > > > > >>> library for video streaming. > > > > > > > > >>> This website was develop during an event with the help of all > > > > > > > >>> developers > > > > > > > >>> attending, "something like a Coding Dojo" > > > > > > > > >>> 2010/10/10 Bruno Rocha > > > > > > > > A student of one of my classes of web2py training in Brazil, > > > > > > > research the > > > > > > > web and made a list of websites powered by web2py. > > > > > > > > he separates in categories: Populars, Great Ones, Good ones > > > > > > > and which keeps > > > > > > > scaffold layout. > > > > > > > > I found good designed websites in that list. > > > > > > > > http://www.elizabethscanvas.org/ > > > > > > > http://www.qakit.com/ > > > > > > > http://ru.ly/( an URL shortener) > > > > > > > > Forwarded is the entire l
[web2py] how to install wizard in this ...
Hi , i had recently seen this video of using the wizard. Its really cool. I want to use that. Person in the video the link saying "create application using wizard" but i don't see any thing like that in my screen and my web2py software is up to date . Please help me with this . If there is anything like i should install some thing please tell me the step by step procedure of doing so. Thanks in advance , Sundeep
[web2py] Loading a pickled file once globally
I am loading a pickled dictionary into memory. I need it to be available to all users all the time. It needs to be loaded only once at application startup. I wrote the following code and put it in models directory code: load_table.py import cPickle as pickle """ Load the file into memory and message the number of entries """ f = open('tables.pkl','rb') session.tables = pickle.load(f) f.close() terms = len(tables.keys()) This made the 'table' variable available globally to all functions in the controller. I was initially using a very small table. Now that the table size has increased, it is taking a long time to query it. Almost equal to loading it each time. How can I speed this up. Should I load it in index() and access via session.table (global)
[web2py] Re: how to install wizard in this ...
Download the "nightly build" from http://web2py.com/examples/default/download Mind it is still experimental (works but we may change it). Massimo On Oct 27, 5:15 am, sunny wrote: > Hi , > i had recently seen this video of using the wizard. Its really cool. I > want to use that. Person in the video the link saying "create > application using wizard" but i don't see any thing like that in my > screen and my web2py software is up to date . Please help me with > this . > If there is anything like i should install some thing please tell me > the step by step procedure of doing so. > > Thanks in advance , > Sundeep
[web2py] Re: Loading a pickled file once globally
In a model: def load(): """ Load the file into memory and message the number of entries """ f = open('tables.pkl','rb') tables = pickle.load(f) f.close() return tables session.tables=cache.ram('tables',load,None) and it will be cached in ram for all users. On Oct 27, 5:15 am, siddharth wrote: > I am loading a pickled dictionary into memory. I need it to be > available to all users all the time. It needs to be loaded only once > at application startup. > I wrote the following code and put it in models directory > > code: load_table.py > > import cPickle as pickle > """ > Load the file into memory and message the number of entries > """ > f = open('tables.pkl','rb') > session.tables = pickle.load(f) > f.close() > terms = len(tables.keys()) > > This made the 'table' variable available globally to all functions in > the controller. I was initially using a very small table. Now that the > table size has increased, it is taking a long time to query it. Almost > equal to loading it each time. How can I speed this up. > > Should I load it in index() and access via session.table (global)
[web2py] Error running routes.py doctest after update to changeset 1054
When I run the doctest for my routes file (python routes.py) after updating to changeset 1054 or later, I receive the following error message: Traceback (most recent call last): File "routes.py", line 103, in from gluon.rewrite import select, load, filter_url, filter_out, filter_err, compile_re File "C:\Users\Public\Documents\WebProjects\TaxClaimPmts\web2py\gluon \rewrite.py", line 17, in from main import abspath File "C:\Users\Public\Documents\WebProjects\TaxClaimPmts\web2py\gluon \main.py", line 88, in import newcron File "C:\Users\Public\Documents\WebProjects\TaxClaimPmts\web2py\gluon \newcron.py", line 19, in import gluon.main as main AttributeError: 'module' object has no attribute 'main' If I run the doctest against changeset 1053, it returns no results (ie, it succeeds/works as expected). Is there some setting or configuration I need to change on my system to support abspath?
Re: [web2py] web2py arguments syntax
Hello, I've made this example using the DAL with Flask, the goal was just to show how the DAL may be used alone in other projects without depending on web2py. I thought about doing this example using GTK or other Python project, but at the time seemed more useful to use a different web framework. I know that the code is weird and not very "Pythonic", but the goal was not to create a "marriage" or an official recipe of hoe to do that. That was made just to show a quick example of using DAL StandAlone. I do not have much experience with Flask (as I have with web2py), but I like a little of how things are done in Flask. but I believe the way to do this in web2py is equally good. And things like Wizards, plugins and other kind of tools is important too. 2010/10/27 VP > I saw this marriage between web2py and Flask (a strange one, I'll give > you that)... but I'm thinking web2py might be able to improve its > syntax/convention as follows. > > Here's Flask: > > @app.route('/insertdog///') > def insertdog(name,owner,age): > # other things > > > Here's web2py: > > def insertdog(): >name, owner, age = request.args(0), request.args(1), > request.args(2) ># these variables might need to be further (type)validated > > > I think there's something not very elegant about this. Ideally, this > is what I want to see in web2py > > def insertdog(name, owner, age): ># request.args should be automatically assigned to these arguments > > > Isn't this a lot nicer? Will this be feasible? Does it contract or > mess up other web2py's ways of doing things? > > If not, can this be done? > > Honestly, I think this is where the money is... at least more so than > the cube2py, wizard thingies. :-) > -- http://rochacbruno.com.br
Re: [web2py] Re: web2py equivalent of Django's pluralize?
Thanks for the link. I can certainly write a function that will do what I need. I just wanted to make sure I wasn't reinventing the wheel (at least with reference to web2py). -Mike On Wed, Oct 27, 2010 at 1:32 PM, Vidul Petrov wrote: > You may want to see this recipe: > http://code.activestate.com/recipes/413172-numbers-and-plural-words-as-spoken-english/ > > The implementation with the help of a module can be easily done. > > > On Oct 27, 4:47 pm, mwolfe02 wrote: >> How do you do this in web2py: >> >> http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=old... >> >> Thanks, >> Mike
[web2py] Patch for cron not working on compiled apps
Hi, cron jobs won't work on a bytecode compiled application after unpacked. When web2py starts, the following error(s) is(are) displayed: invalid application name: testapp/cron/crontask the crontab file looks like: #crontab * * * * * root *cron/crontask it looks like gluon/shell.py is not working for bytecode compiled applications, as it's searching for the .py file: cfile = os.path.join('applications', a, 'controllers', c + '.py') Suggested patch attached. Greets. -- Álvaro J. Iradier Muro Departamento de Desarrollo alvaro.irad...@polartech.es Polar Technologies T +34 976 527 952 F +34 976 466 125 www.polartech.es Antes de imprimir este mensaje, por favor, compruebe que es verdaderamente necesario. El medioambiente es cosa de todos. AVISO LEGAL Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener información confidencial, siendo para uso exclusivo del destinatario, quedando prohibida su divulgación, copia o distribución a terceros sin la autorización expresa del remitente. Si Vd. ha recibido este mensaje erróneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboración. shell.py.patch Description: Binary data
[web2py] Render svg using web2py without js library
Hello web2py users, I'm having trouble rendering SVG in firefox using web2py without using a js library. For instance, take this simple example here : http://www.w3schools.com/svg/tryit.asp?filename=rect1&type=svg Can anyone give me an example of how to render this using web2py ? Thanks in advance, Chris Baron
[web2py] Record Versioning
I am trying to use versioning in an authenticated section of a website. Instead of this: db.define_table('my_table', Field('saved_by',auth.user, default=auth.user_id,update=auth.user_id,writable=False) I was trying this: db.define_table('my_table', Field('saved_by','string', default=auth.user.username,update=auth.user.username, writable=False) Whenever I try to visit the website's home page (as an unauthenticated user) web2py chokes on the table definition in models/ db.py. See below for the traceback. Any idea how to solve this? Maybe I should use a decorator with the define_table statement? Regards, Andreas balo...@gmail.com -- Error traceback 1. 2. 3. 4. 5. 6. 7. Traceback (most recent call last): File "D:\Home\web\web2py\gluon\restricted.py", line 188, in restricted exec ccode in environment File "D:/Home/web/web2py/applications/invest/models/db.py", line 159, in Field('change_user', 'string', default=auth.user.username, update=auth.user.username, writable=False), AttributeError: 'NoneType' object has no attribute 'username' Error snapshot Detailed traceback description * Exception: ('NoneType' object has no attribute 'username') Exception instance attributes o args: ("'NoneType' object has no attribute 'username'",) o __setattr__: o __reduce_ex__: o __getslice__: o __getitem__: o __setstate__: o __getattribute__: o __str__: o __format__: o __reduce__: o __class__: o __dict__: {} o __delattr__: o __subclasshook__: o __repr__: o __init__: o __hash__: o __sizeof__: o __doc__: 'Attribute not found.' o __unicode__: o __new__: * Python 2.6.5: C:\Program Files\Apache2.2\bin\httpd.exe File D:\Home\web\web2py\gluon\restricted.py in restricted at line 188 [ code | arguments | variables ] Function argument list: (code='# coding: utf8\n\nimport datetime as dt \n\n#...ail),\n db.email)\n \n', environment={'A': , 'Auth': , 'B': , 'BEAUTIFY': , 'BODY': , 'BR': , 'CENTER': , 'CLEANUP': , 'CODE': , 'CRYPT': , ...}, layer=r'D:\Home\web \web2py\applications\invest/models/db.py') 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. if type(code) == types.CodeType: ccode = code else: ccode = compile2(code,layer) exec ccode in environment except HTTP: raise except Exception: # XXX Show exception in Wing IDE if running in debugger * environment: {'A': , 'Auth': , 'B': , 'BEAUTIFY': , 'BODY': , 'BR': , 'CENTER': , 'CLEANUP': , 'CODE': , 'CRYPT': , ...} * ccode: at 03DB9BA8, file "D:\Home...web2py \applications\invest/models/db.py", line 3> File D:\Home\web\web2py\applications\invest\models\db.py in at line 159 [ code | arguments | variables ] Function argument list: () 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. db.define_table('email', Field('email', 'string', length=40, notnull=False, unique=True, represent=lambda s: s), Field('active', 'boolean', default=True), Field('expires', 'date', default=None, represent=lambda s: s or 'Never'), Field('change_user', 'string', default=auth.user.username, update=auth.user.username, writable=False), Field('change_date', 'datetime', default=request.now, update=request.now, writable=False), ) db.define_table('email_archive', * default: undefined * Field: * auth.username: undefined * auth:
[web2py] Re: Best way to update schedule with multiple users/locations?
what about a javascript timer that makes a JSON call to check for updates every x minutes? i suspect that the database can be designed in such a way that the query could be quite quick. then you don't need queues and background processes. just a thought... cfh On Oct 26, 9:23 pm, Tom Campbell wrote: > I'm writing a scheduling system in web2py. It can be used by multiple > users in multiple locations. If one user adds an appointment, I'd like > other users to see it within 10 seconds or so. What is the preferred > mechanism for this? My poorly educated guess is: > > 1. An updater runs as a single background process as in section 4.19, > checking the database for new or changed appointments at all locations > and enqueues them > 2. Each client schedule running in browser runs a cron job to check > the queue for matching appointments > 3. If any appointments in the queue satisfy the search criteria (i.e. > appointments at that location), the calendar gets redrawn > > Any feedback would be greatly appreciated.
[web2py] Re: clean up uservoice
On Oct 27, 9:49 am, Bruno Rocha wrote: > I think Googlehttp://www.google.com/moderator/should be better for that! what are advantages of Moderator over uservoice?
[web2py] Some beginner questions on form
Hello, I am doing my first application with web2py and I don't know how to do some things with forms. Like I would like to show a drop menu to show the possible values for a text field. How can I specify this menu with define_table? Another thing that I would like to do is format postal code and phone numbers with javascript when the user leaves a field. Could you guide me on this?
Re: [web2py] Re: clean up uservoice
I think, being a google tool has its advantage, the ease of use, the ease of authentication, the ease of integration with google tools. Regarding interface, I like most the Google Moderator interface, and there we can separate things by topic Lets give it a try: http://www.google.com/moderator/#16/e=33f86 2010/10/27 Richard > On Oct 27, 9:49 am, Bruno Rocha wrote: > > I think Googlehttp://www.google.com/moderator/should be better for that! > > what are advantages of Moderator over uservoice? -- http://rochacbruno.com.br
[web2py] Re: forms2pdf: new free web2py appliance
requires trunk On Oct 27, 11:48 am, Christopher Steel wrote: > Great application! > > When running with Web2py Version 1.87.3 (2010-10-13 19:44:46) > > I am getting the error: > > File "/Users/christophersteel/dev/web2py/applications/forms2pdf/ > controllers/default.py", line 63, in form_get > pdf,warnings,errors=markmin2pdf(record.f_content,extra=extra) > TypeError: markmin2pdf() got an unexpected keyword argument 'extra' > > o args: ("markmin2pdf() got an unexpected keyword argument > 'extra'",) > * Python 2.5.4: /Library/Frameworks/Python.framework/Versions/2.5/ > Resources/Python.app/Contents/MacOS/Python > > Thanks, > > Chris > > On Oct 25, 2:55 pm, mdipierro wrote: > > >http://web2py.com/appliances/default/show/69 > >
[web2py] Re: web2py arguments syntax
Easy answer. It cannot be done. Flask and Django execute the controller (sees the decorator and registers it) before any http request arrives. Web2py executes the controller after the http request arrives. Morover changing it (even if it were possible) would be a change in backward compatibility. Difficult answer. There may be a way... let me give it some thought, just as a proof of concept. On Oct 27, 10:43 am, VP wrote: > I saw this marriage between web2py and Flask (a strange one, I'll give > you that)... but I'm thinking web2py might be able to improve its > syntax/convention as follows. > > Here's Flask: > > @app.route('/insertdog///') > def insertdog(name,owner,age): > # other things > > Here's web2py: > > def insertdog(): > name, owner, age = request.args(0), request.args(1), > request.args(2) > # these variables might need to be further (type)validated > > I think there's something not very elegant about this. Ideally, this > is what I want to see in web2py > > def insertdog(name, owner, age): > # request.args should be automatically assigned to these arguments > > Isn't this a lot nicer? Will this be feasible? Does it contract or > mess up other web2py's ways of doing things? > > If not, can this be done? > > Honestly, I think this is where the money is... at least more so than > the cube2py, wizard thingies. :-)
Re: [web2py] Re: clean up uservoice
we are using that for PyCon Brasil look: https://www.google.com/moderator/#15/e=351cc&t=351cc.41&f=351cc.a9e3b we can try a little, and if not works we leave that Lets give it a try: http://www.google.com/moderator/#16/e=33f86 2010/10/27 Bruno Rocha > I think, being a google tool has its advantage, the ease of use, the ease > of authentication, the ease of integration with google tools. > > Regarding interface, I like most the Google Moderator interface, and there > we can separate things by topic > > Lets give it a try: http://www.google.com/moderator/#16/e=33f86 > > 2010/10/27 Richard > > On Oct 27, 9:49 am, Bruno Rocha wrote: >> > I think Googlehttp://www.google.com/moderator/should be better for >> that! >> >> what are advantages of Moderator over uservoice? > > > > > -- > > http://rochacbruno.com.br > -- http://rochacbruno.com.br
Re: [web2py] Re: clean up uservoice
And look this : http://goo.gl/mod/Aj8g 2010/10/27 Richard > On Oct 27, 9:49 am, Bruno Rocha wrote: > > I think Googlehttp://www.google.com/moderator/should be better for that! > > what are advantages of Moderator over uservoice? -- http://rochacbruno.com.br
Re: [web2py] Re: web2py arguments syntax
> > Morover changing it (even > if it were possible) would be a change in backward compatibility. > Speaking of backwards compatibility, sometimes I see some users are tending more to have new features and design changes than maintaining backward compatibility I think backwards compatibility is one of the most important things in web2py, and this gives us security, that matters at all. But perhaps one day will be necessary to have the option of working in different ways to take advantage of the rapidly evolving concepts of web development. It would be a bad idea to have a way to configure the compatibility mode? At some per application startup script or config: (could be in models/0.py?) BACKWARDS_COMPATIBILITY = True | False Depending on this configuration could use the web2py new implementations/changes or keeping compatibility I know this may be more complicated than I imagine, but can be a way out in the future as well as Python did in reverse way with "from __future__ import *" just wondering
[web2py] Re: clean up uservoice
Looks good. One potential problem -- it looks like you can only sort (by date, popularity, what's hot) _within_ each topic. That will make it difficult to see which suggestions are most popular overall. Or am I missing something? Anthony On Oct 27, 10:00 pm, Bruno Rocha wrote: > And look this :http://goo.gl/mod/Aj8g > > 2010/10/27 Richard > > > On Oct 27, 9:49 am, Bruno Rocha wrote: > > > I think Googlehttp://www.google.com/moderator/shouldbe better for that! > > > what are advantages of Moderator over uservoice? > > -- > > http://rochacbruno.com.br
[web2py] Re: Some beginner questions on form
On Oct 27, 7:45 pm, pierreth wrote: > Hello, > > I am doing my first application with web2py and I don't know how to do > some things with forms. > > Like I would like to show a drop menu to show the possible values for > a text field. How can I specify this menu with define_table? > Field('name',requires=IS_IN_SET(('value1,'value2',value3'))) > Another thing that I would like to do is format postal code and phone > numbers with javascript when the user leaves a field. jQuery(document).ready(function(){ var t=jQuery('#table_field'); t.keyup(function(){t.val(format(t.val());}); }); where "table" and "field" are your table and field names. format(...) is the function that formats the input into output and you need to define it in JS. > Could you guide me on this?
[web2py] Re: Record Versioning
The problem is that update=auth.user.username the right hand site is node defined if you are not logged in. Try: update=auth.user and auth.user.username On Oct 27, 4:50 pm, baloan wrote: > I am trying to use versioning in an authenticated section of a > website. Instead of this: > > db.define_table('my_table', > Field('saved_by',auth.user, > default=auth.user_id,update=auth.user_id,writable=False) > > I was trying this: > > db.define_table('my_table', > Field('saved_by','string', > default=auth.user.username,update=auth.user.username, writable=False) > > Whenever I try to visit the website's home page (as an > unauthenticated user) web2py chokes on the table definition in models/ > db.py. See below for the traceback. > > Any idea how to solve this? > Maybe I should use a decorator with the define_table statement? > > Regards, Andreas > balo...@gmail.com > > -- > > Error traceback > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > > Traceback (most recent call last): > File "D:\Home\web\web2py\gluon\restricted.py", line 188, in > restricted > exec ccode in environment > File "D:/Home/web/web2py/applications/invest/models/db.py", line > 159, in > Field('change_user', 'string', default=auth.user.username, > update=auth.user.username, writable=False), > AttributeError: 'NoneType' object has no attribute 'username' > > Error snapshot > Detailed traceback description > > * Exception: ('NoneType' object > has no attribute 'username') > Exception instance attributes > o args: ("'NoneType' object has no attribute 'username'",) > o __setattr__: exceptions.AttributeError object> > o __reduce_ex__: exceptions.AttributeError object> > o __getslice__: exceptions.AttributeError object> > o __getitem__: exceptions.AttributeError object> > o __setstate__: exceptions.AttributeError object> > o __getattribute__: exceptions.AttributeError object> > o __str__: exceptions.AttributeError object> > o __format__: exceptions.AttributeError object> > o __reduce__: exceptions.AttributeError object> > o __class__: > o __dict__: {} > o __delattr__: exceptions.AttributeError object> > o __subclasshook__: type object> > o __repr__: exceptions.AttributeError object> > o __init__: exceptions.AttributeError object> > o __hash__: exceptions.AttributeError object> > o __sizeof__: exceptions.AttributeError object> > o __doc__: 'Attribute not found.' > o __unicode__: exceptions.AttributeError object> > o __new__: > * Python 2.6.5: C:\Program Files\Apache2.2\bin\httpd.exe > > File D:\Home\web\web2py\gluon\restricted.py in restricted at line 188 > [ code | arguments | variables ] > Function argument list: (code='# coding: utf8\n\nimport datetime as dt > \n\n#...ail),\n db.email)\n \n', environment={'A': 'gluon.html.A'>, 'Auth': , 'B': 'gluon.html.B'>, 'BEAUTIFY': , 'BODY': > , 'BR': , 'CENTER': > , 'CLEANUP': 'gluon.validators.CLEANUP'>, 'CODE': , > 'CRYPT': , ...}, layer=r'D:\Home\web > \web2py\applications\invest/models/db.py') > > 183. > 184. > 185. > 186. > 187. > 188. > > 189. > 190. > 191. > 192. > > if type(code) == types.CodeType: > ccode = code > else: > ccode = compile2(code,layer) > > exec ccode in environment > > except HTTP: > raise > except Exception: > # XXX Show exception in Wing IDE if running in debugger > > * environment: {'A': , 'Auth': 'gluon.tools.Auth'>, 'B': , 'BEAUTIFY': 'gluon.html.BEAUTIFY'>, 'BODY': , 'BR': > , 'CENTER': , > 'CLEANUP': , 'CODE': 'gluon.html.CODE'>, 'CRYPT': , ...} > * ccode: at 03DB9BA8, file "D:\Home...web2py > \applications\invest/models/db.py", line 3> > > File D:\Home\web\web2py\applications\invest\models\db.py in > at line 159 > [ code | arguments | variables ] > Function argument list: () > > 154. > 155. > 156. > 157. > 158. > 159. > > 160. > 161. > 162. > 163. > > db.define_table('email', > Field('email', 'string', length=40, notnull=False, > unique=True, represent=lambda s: s), > Field('active', 'boolean', default=True), > Field('expires', 'date', default=None, > represent=lambda s: s or 'Never'), > Field('change_user', 'string', default=auth.user.username, > update=auth.user.username, writable=False), > > Field('change_date', 'datetime', default=request.now, > update=request.now, writable=False), > ) > > db.define_table('email_archive', > > * default: undefined > * Field: > * auth.username: undefined > * auth:
[web2py] Re: web2py arguments syntax
I do not think we should ever break backward compatibility in order to change syntax (because here there is nothing more that syntax at stake, not functionality). Different people have different preferences. Can you think of any case where backward compatibility has prevented us form adding a read feature? Massimo On Oct 27, 9:27 pm, Bruno Rocha wrote: > > Morover changing it (even > > if it were possible) would be a change in backward compatibility. > > Speaking of backwards compatibility, sometimes I see some users are tending > more to have new features and design changes than maintaining backward > compatibility > > I think backwards compatibility is one of the most important things in > web2py, and this gives us security, that matters at all. > > But perhaps one day will be necessary to have the option of working in > different ways to take advantage of the rapidly evolving concepts of web > development. > > It would be a bad idea to have a way to configure the compatibility mode? > > At some per application startup script or config: (could be in > models/0.py?) > > BACKWARDS_COMPATIBILITY = True | False > > Depending on this configuration could use the web2py new > implementations/changes or keeping compatibility > > I know this may be more complicated than I imagine, but can be a way out in > the future as well as Python did in reverse way with "from __future__ import > *" > > just wondering
Re: [web2py] Re: web2py arguments syntax
No, I do not know of any case and I'm not proposing to break compatibility, I love the backwards compatibility and the "web2py" way of doing things. I was just wondering if by chance it might not be an issue to think about. There is no way to measure how far the maintenance of compatibility could lead to API conflicts or anything like that. Or even to implement new and different ways of writing the same things (only syntax changes as you said) I saw that kind of thing in Pylons when I needed to move from 0.9.x to 1.0 (in a strange way using an IF/try statement for conditional imports), as I saw that in web.config for .net framework (the hell of dll version control) as I saw this in PHP.ini file when moving to 5.2 but, nevermind about that, random wonder 2010/10/28 mdipierro > I do not think we should ever break backward compatibility in order to > change syntax (because here there is nothing more that syntax at > stake, not functionality). > > Different people have different preferences. > > Can you think of any case where backward compatibility has prevented > us form adding a read feature? > > Massimo > > > On Oct 27, 9:27 pm, Bruno Rocha wrote: > > > Morover changing it (even > > > if it were possible) would be a change in backward compatibility. > > > > Speaking of backwards compatibility, sometimes I see some users are > tending > > more to have new features and design changes than maintaining backward > > compatibility > > > > I think backwards compatibility is one of the most important things in > > web2py, and this gives us security, that matters at all. > > > > But perhaps one day will be necessary to have the option of working in > > different ways to take advantage of the rapidly evolving concepts of web > > development. > > > > It would be a bad idea to have a way to configure the compatibility mode? > > > > At some per application startup script or config: (could be in > > models/0.py?) > > > > BACKWARDS_COMPATIBILITY = True | False > > > > Depending on this configuration could use the web2py new > > implementations/changes or keeping compatibility > > > > I know this may be more complicated than I imagine, but can be a way out > in > > the future as well as Python did in reverse way with "from __future__ > import > > *" > > > > just wondering > -- http://rochacbruno.com.br