[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 vtp2...@gmail.com 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/name/age/owner') 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: web2py arguments syntax
On Oct 27, 5:43 pm, VP vtp2...@gmail.com wrote: @app.route('/insertdog/name/age/owner') def insertdog(name,owner,age): # other things For fun, I tried an experiment with decorators. Hold onto your seats: # Simulation of the request object class R(object): pass request = R() request.args=['caleb', 100] # A validating decorator---put somewhere in web2py def validator(*args): assert(len(args)==len(request.args)) def inner(f): for name, value in zip(args, request.args): setattr(f, name, value) return f return inner # ** # This is how it will be used in the controller file # ** @validator('first_name', 'age') def controller_action(): return controller_action.first_name, controller_action.age == OUTPUT: ('caleb', 100)
[web2py] Re: web2py arguments syntax
On Oct 28, 9:53 am, cjrh caleb.hatti...@gmail.com wrote: On Oct 27, 5:43 pm, VP vtp2...@gmail.com wrote: @app.route('/insertdog/name/age/owner') def insertdog(name,owner,age): # other things For fun, I tried an experiment with decorators. Hold onto your seats: Naturally, this closer simulation of app.route syntax also works (but I think the former separate arguments form works better): class R(object): pass request = R() request.args=['caleb', 100] def validator(route): args = route.split('/')[2:] args = [i.replace('', '').replace('', '') for i in args] assert(len(args)==len(request.args)) def inner(f): for name, value in zip(args, request.args): setattr(f, name, value) return f return inner @validator('/controller_action/first_name/age') def controller_action(): return f.first_name, f.age print f() == OUTPUT: ('caleb', 100)
Re: [web2py] Re: web2py arguments syntax
In this case, readability counts. Bringing backwards compatibility and readability altoghether, is the ideal world. As we can see, cjrh achieved that in a way. This cannot be the ideal yet, but there is a path to it. ;-) In my opinion, this feature improve readability, among other things. Method signature is a good thing. Following The Zen of Python, explicit is better than implicit. ;-) Congrats, cjrh. Massimo, I think it can be a good feature, mainly for beginners. But only if I don't need to implement my own request object. It would bring complexity and makes me worry about the technical solution, not about my problem (url mapping and params). -- Vinicius Assef. On Thu, Oct 28, 2010 at 6:39 AM, cjrh caleb.hatti...@gmail.com wrote: On Oct 28, 9:53 am, cjrh caleb.hatti...@gmail.com wrote: On Oct 27, 5:43 pm, VP vtp2...@gmail.com wrote: @app.route('/insertdog/name/age/owner') def insertdog(name,owner,age): # other things For fun, I tried an experiment with decorators. Hold onto your seats: Naturally, this closer simulation of app.route syntax also works (but I think the former separate arguments form works better): class R(object): pass request = R() request.args=['caleb', 100] def validator(route): args = route.split('/')[2:] args = [i.replace('', '').replace('', '') for i in args] assert(len(args)==len(request.args)) def inner(f): for name, value in zip(args, request.args): setattr(f, name, value) return f return inner @validator('/controller_action/first_name/age') def controller_action(): return f.first_name, f.age print f() == OUTPUT: ('caleb', 100)
[web2py] Static folder and cookies
In the performance report for my site it says: Serve the following static resources from a domain that doesn't set cookies: http://www.mydomain/application/static/css/base.css http://www.mydomain/application/static/images/image.jpg Instead of serving the static resources from a different domain I wonder whether is possible to just not set cookies on the resources in the static folder. Kind regards, Annet.
[web2py] width and height attribute IMG helper
Is it possible to set a width and height attribute using the following IMG helper? {{=IMG(_src=URL(r=request,c='static',f='init/businesscard/ image.jpg'))}} Kind regards, Annet
Re: [web2py] web2py arguments syntax
On Wed, Oct 27, 2010 at 5:43 PM, VP vtp2...@gmail.com wrote: def insertdog(name, owner, age): # request.args should be automatically assigned to these arguments I also prefer this over manual extraction from the request object. But I do hate the decorator syntax. I think controllers are no place to deal with the actual URL patterns. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
Re: [web2py] width and height attribute IMG helper
{{=IMG(_src=URL(r=request,c='static',f='init/businesscard/ image.jpg'),_width=200px,_height=200px)}} 2010/10/28 annet annet.verm...@gmail.com Is it possible to set a width and height attribute using the following IMG helper? {{=IMG(_src=URL(r=request,c='static',f='init/businesscard/ image.jpg'))}} Kind regards, Annet -- http://martin.tecnodoc.com.ar
[web2py] Re: Using list:reference in a model on GAE
I am not sure what the line stories=db(db.story.roadtrip[roadtrip_id]).select(orderby=db.story.title) is supposed to do but it is invalid because the syntax is stories=db(query).select() but db.story.roadtrip[roadtrip_id] is not a query. In fact I am not sure what it is since db.story.roadtrip is a field object and it does not support the [roardtrip_ip]. That is the error. On Oct 28, 12:15 am, johntynan jgty...@gmail.com wrote: 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_... 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/controller... The error seems to go away. Thank you for any advice or suggestions.
[web2py] Re: reg:DAL and google datastore
You can use any module as long as you import it. On Oct 28, 1:04 am, bally boy ballybo...@gmail.com wrote: 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] Fwd: [Chicago] open Python contract
Begin forwarded message: From: Steve Riess sri...@nu-waysearch.com Date: October 27, 2010 12:39:01 PM CDT To: chic...@python.org Subject: [Chicago] open Python contract Reply-To: The Chicago Python Users Group chic...@python.org I’m actively recruiting for this position, and thought I would post here and see if anyone might be interested. Enterprise Systems Management Engineer Python 6-12 month contract Schaumburg Summary: The online business Enterprise Systems Management (ESM) Engineer is responsible for developing, implementing, testing, documenting, deploying, and maintaining the components of the Enterprise Systems Management infrastructure. The ESM infrastructure is used by the online business Operations, Engineering and Software Development teams, for the day-to-day operation of the online business’ web sites. The components include applications and utilities for systems, network and application monitoring; problem management; configuration management and change control; log analysis; security and event management. In addition to participating in the ongoing development and upgrade of the technical systems monitoring and management capabilities, the ESM Engineer will also assist in enhancing the overall organizational management capabilities by facilitating ongoing knowledge transfer and information sharing activities. Responsibilities: Responsible for the product lifecycle management of the ESM infrastructure and tools as well as the integration of management tools and the correlation of events from various technology disciplines including systems, networks, database and application development. Build-out the new systems management toolset enabling system, network and application monitoring and management; capacity and performance management; configuration management and problem management. Leveraging a combination of open-source, proprietary software and custom development, to deliver new and enhanced monitoring capabilities. Partner with the Operations, Infrastructure Engineering, Application Support, DBAs, and Software Engineering teams to develop, implement and maintain the Systems Management strategy, tools and operations. Work with teams from other technology disciplines to assist in the development of a support model to ensure alerts are properly escalated and consistently forwarded to the correct support groups. Develop and maintain the associated systems management processes and procedures, including: collecting, analyzing and disseminating operational metrics; establishing and maintaining SOPs; performing event correlation. Provide technical assistance for ESM systems management tools. Participate in ESM 24x7 on-call rotation for support and problem resolution. Assist in the support the overall monitoring and management environments (server, network, storage, database and application infrastructure) ensuring accuracy, availability and responsiveness. Design and develop monitoring thresholds and custom alerts and response scripts. Develop, maintain and report relevant monitoring metrics capturing customer relevant issues. Establish and follow a structured methodology for implementing system changes, configuration modifications and application upgrades. Required Skills: Extensive experience developing applications in Python. Desired Skills: Experience developing monitoring applications leveraging scripting languages (Bash, Korn, etc.) or higher level programming language. Some software development experience in Perl, Java and/or C/C++. Extensive experience implementing and maintaining both open source and proprietary network monitoring tools such as Net-SNMP, OpenNMS, Zabbix, HPOV, BMC, etc. Experience with SNMP, including MIB development and implementation is required. Significant experience developing methods and procedures. Strong documentation skills. Experience implementing, developing and configuring tools that monitor database platforms, UNIX servers, IP networks and mission-critical systems. 3-5 years experience in UNIX / Linux administration and installation of systems and applications software. Various levels of experience with the technologies typically associated with modern large scale internet sites, including: web servers, application servers, Java, NAS/SAN, relational databases, etc. Knowledge and experience in the administration and operations of large scale distributed computing environments. Experience with standard system Operations methods and procedures. Prior hosting experience a plus Familiarity with network architecture, protocols and services, including: switches, load balancers, firewalls, routing, TCP, UDP, HTTP/S, DNS, SSL, SNMP, SMTP, VPN, etc. System implementation and automation experience with multiple technologies required. Would you be interested in exploring this opportunity ? Steve
[web2py] Re: Static folder and cookies
I do not think web2py sets cookies for static files. If it does it is a bug. Anyway, you should let apache serve static files, not web2py. Massimo On Oct 28, 6:01 am, annet annet.verm...@gmail.com wrote: In the performance report for my site it says: Serve the following static resources from a domain that doesn't set cookies: http://www.mydomain/application/static/css/base.csshttp://www.mydomain/application/static/images/image.jpg Instead of serving the static resources from a different domain I wonder whether is possible to just not set cookies on the resources in the static folder. Kind regards, Annet.
[web2py] auth.change_password form customization
Hi there, As we can use auth.change_password() to add up Change Password functionality, can I customize this form and add some more fields to change user's preferences, name, email etc? Please suggest Aniket
[web2py] Re: auth.change_password form customization
That is done in auth.profile() Anyway, auth_user is a regular table so you can make your own SQLFORM(s) from it. On Oct 28, 1:37 am, Aniket Arora aniket.ar...@gmail.com wrote: Hi there, As we can use auth.change_password() to add up Change Password functionality, can I customize this form and add some more fields to change user's preferences, name, email etc? Please suggest Aniket
[web2py] Re: web2py arguments syntax
On Oct 28, 11:02 am, Vinicius Assef vinicius...@gmail.com wrote: Massimo, I think it can be a good feature, mainly for beginners. But only if I don't need to implement my own request object. No, you don't need to make your own request object, I just included it here to test my idea in an interpreter window, and thought other people might want to do that too. The idea is that only the decorator around the controller function would be required in user applications. The other stuff would be built-in. (IOW the request object would be the same request object we currently use in our web2py apps.)
[web2py] Re: web2py arguments syntax
Out of the box you can do: @service.run def insertdog(name,owner,age): # other things and in routes: routes_in=[ ('/app/default/insertdog/$name/$age/$owner', '/app/default/call/run/insertdog/$name/$age/$owner')] I guess we can make another decorator that automatically registers the routes. On Oct 28, 3:39 am, cjrh caleb.hatti...@gmail.com wrote: On Oct 28, 9:53 am, cjrh caleb.hatti...@gmail.com wrote: On Oct 27, 5:43 pm, VP vtp2...@gmail.com wrote: @app.route('/insertdog/name/age/owner') def insertdog(name,owner,age): # other things For fun, I tried an experiment with decorators. Hold onto your seats: Naturally, this closer simulation of app.route syntax also works (but I think the former separate arguments form works better): class R(object): pass request = R() request.args=['caleb', 100] def validator(route): args = route.split('/')[2:] args = [i.replace('', '').replace('', '') for i in args] assert(len(args)==len(request.args)) def inner(f): for name, value in zip(args, request.args): setattr(f, name, value) return f return inner @validator('/controller_action/first_name/age') def controller_action(): return f.first_name, f.age print f() == OUTPUT: ('caleb', 100)
Re: [web2py] Re: web2py arguments syntax
On Thu, Oct 28, 2010 at 3:20 PM, mdipierro mdipie...@cs.depaul.edu wrote: Out of the box you can do: @service.run def insertdog(name,owner,age): # other things and in routes: routes_in=[ ('/app/default/insertdog/$name/$age/$owner', '/app/default/call/run/insertdog/$name/$age/$owner')] I guess we can make another decorator that automatically registers the routes. But this is perfectly fine, though. Most frameworks I've worked with do some variant of the above, and I don't see people complaining. On the other hand, maybe there could be an UI for routes in the admin section. Make it obvious that routes are there. And maybe per-app routing to be available on edit pages. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] IMG helper and attributes
Is it possible to set a width and height attribute using the following IMG helper? {{=IMG(_src=URL(r=request,c='static',f='init/businesscard/ image.jpg'))}} Kind regards, Annet
[web2py] Re: IMG helper and attributes
Yes, just use _width and _height attributes. All attributes started with underscore are being translated into common html attributes. On 28 říj, 15:34, annet annet.verm...@gmail.com wrote: Is it possible to set a width and height attribute using the following IMG helper? {{=IMG(_src=URL(r=request,c='static',f='init/businesscard/ image.jpg'))}} Kind regards, Annet
[web2py] Re: Static folder and cookies
You mean in a production environment I should not serve static files from the apps static folder? What happens to the dynamic URLs in that case? At the moment I edit the static files within web2py, and I quite like the 'pack all' and 'upload and install packed application' features to deploy an application. If I'd move all the static files to Apache, deploying an application would become more complicated, wouldn't it. BTW I tested the performance of my application here: http://groups.google.com/group/web2py/browse_thread/thread/da47638dbc515735 Does anyone of you get the same remarks about cookieless domains? Kind regards, Annet.
[web2py] Re: Patch for cron not working on compiled apps
uploading to trunk On Oct 27, 3:47 pm, Álvaro J. Iradier alvaro.irad...@polartech.es wrote: 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 125www.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 1KViewDownload
[web2py] TextWidget maximum
I need to paste large texts into a db table field using appadmin. Table field is defined as 'text' and in MySQL is mapped to 'longtext'. Longtext capacity is 4GB or so... I need to paste approx. 1 Mb of text into the field. When I do it in web2py appadmin I get an error enter from 0 to 65536 characters. I believe this is produced by a widget? How is it possible to disable this limit?
Re: [web2py] Re: Static folder and cookies
It is referring to the root domain having a cookie, in this case, navigating to www.mydomain.com gives a cookie. so this benchmark website is not 100% smart about the fact if cookies are sent with static files. If you really want to, set up an apache domain to serve static files as like static.mydomain.com, and then use web2py routes to redirect to the correct static subdomain. -- Thadeus On Thu, Oct 28, 2010 at 8:51 AM, annet annet.verm...@gmail.com wrote: You mean in a production environment I should not serve static files from the apps static folder? What happens to the dynamic URLs in that case? At the moment I edit the static files within web2py, and I quite like the 'pack all' and 'upload and install packed application' features to deploy an application. If I'd move all the static files to Apache, deploying an application would become more complicated, wouldn't it. BTW I tested the performance of my application here: http://groups.google.com/group/web2py/browse_thread/thread/da47638dbc515735 Does anyone of you get the same remarks about cookieless domains? Kind regards, Annet.
[web2py] Re: web2py arguments syntax
On Oct 28, 10:39 am, cjrh caleb.hatti...@gmail.com wrote: On Oct 28, 9:53 am, cjrh caleb.hatti...@gmail.com wrote: @validator('/controller_action/first_name/age') def controller_action(): return f.first_name, f.age Sorry, this should be: @validator('/controller_action/first_name/age') def controller_action(): return controller_action.first_name, controller_action.age
[web2py] little typo in tools.py
Hello, At line ~1062 in trunk : bar = SPAN(prefix,self.user.first_name,' [ ', logout, ' ]',_class='auth_navbar') Need a white space. Richard
[web2py] Re: Loading a pickled file once globally
That did it. I had read a similar post later in the group. I was using tables = cache.ram('tables',lambda:load(),10**10) will modify it now. Is there any difference between using session.tables and just tables when its cached in RAM ? On Oct 27, 7:40 pm, mdipierro mdipie...@cs.depaul.edu wrote: 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 sharmasiddhart...@gmail.com 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] What am I missing when trying to update table_user_name?
I am trying to add a registration step when users login using OAuth (LinkedIn in my example). a) am I taking a good approach? b) why am I getting an exception when I try to write to my user table? From db.py: auth.settings.table_user = db.define_table( auth.settings.table_user_name, db.Field('email', 'string', length=254, unique=True, notnull=True, required=True, requires = [IS_LOWER(), IS_EMAIL(), IS_NOT_IN_DB(db,'%s.email'%auth.settings.table_user_name)]), db.Field('password', 'password', length=512, readable=False, label='Password', requires = [CRYPT(key='***')]), db.Field('registration_id', length=512, writable=False, readable=False, default=''), db.Field('registration_key', length=512, writable=False, readable=False, default=''), db.Field('first_name', 'string', length=128), db.Field('last_name', 'string', length=128)) The rest is in default.py: def user: auth.settings.login_next = URL(r=request,f='registerLinkedInAgent') auth.settings.login_form=LinkedInAccount(globals(),CLIENT_ID,CLIENT_SECRET, AUTH_URL, TOKEN_URL, ACCESS_TOKEN_URL) return dict(form=auth()) I won't include LinkedInAccount() here but the issue I have is in registerAgent(form) def registerLinkedInAgent(): if auth.user.registration_key and len(auth.user.registration_key): auth.add_membership(auth.id_group( 'agent'), auth.user.id) # here I do my once-on-registration calls do_registration_stuff() # find current user's record and update registration key to an empty string so this code isn't called again users = db(db.auth_user.id==auth.user.id).select(db.auth_user.ALL) if users and len(users): users[0].update_record({'registration_key''}) redirect(URL('account')) The problem is I get ValueError: need more than 1 value to unpack . Full trackback is below: Traceback (most recent call last): File E:\projects\workspace\TestEnvoy\web2py\gluon\restricted.py, line 188, in restricted exec ccode in environment File E:/projects/workspace/TestEnvoy/web2py/applications/init/ controllers/default.py, line 1528, in module File E:\projects\workspace\TestEnvoy\web2py\gluon\globals.py, line 96, in lambda self._caller = lambda f: f() File E:/projects/workspace/TestEnvoy/web2py/applications/init/ controllers/default.py, line 1132, in registerLinkedInAgent users[0].update_record({'registration_key' : ''}) File E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py, line 3381, in lambda colset.update_record = lambda _ = (colset, table, id), **a: update_record(_, a) File E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py, line 3508, in update_record (colset, table, id) = pack ValueError: need more than 1 value to unpack If anyone needs greater explanation please complain and I'll add more! :)
Re: [web2py] Re: web2py arguments syntax
Nice. :-D On Thu, Oct 28, 2010 at 11:20 AM, mdipierro mdipie...@cs.depaul.edu wrote: Out of the box you can do: @service.run def insertdog(name,owner,age): # other things and in routes: routes_in=[ ('/app/default/insertdog/$name/$age/$owner', '/app/default/call/run/insertdog/$name/$age/$owner')] I guess we can make another decorator that automatically registers the routes. On Oct 28, 3:39 am, cjrh caleb.hatti...@gmail.com wrote: On Oct 28, 9:53 am, cjrh caleb.hatti...@gmail.com wrote: On Oct 27, 5:43 pm, VP vtp2...@gmail.com wrote: @app.route('/insertdog/name/age/owner') def insertdog(name,owner,age): # other things For fun, I tried an experiment with decorators. Hold onto your seats: Naturally, this closer simulation of app.route syntax also works (but I think the former separate arguments form works better): class R(object): pass request = R() request.args=['caleb', 100] def validator(route): args = route.split('/')[2:] args = [i.replace('', '').replace('', '') for i in args] assert(len(args)==len(request.args)) def inner(f): for name, value in zip(args, request.args): setattr(f, name, value) return f return inner @validator('/controller_action/first_name/age') def controller_action(): return f.first_name, f.age print f() == OUTPUT: ('caleb', 100)
[web2py] Re: What am I missing when trying to update table_user_name?
2nd thoughts, here's the missing function in db.py One can't get an email back from LinkedIn so I set the email field to the user's LinkedIn id it also returns to set the registration_key so that my registration key can fire off (and clear this field once completed) - it is in the function registerLinkedInAgent() that it fails to clear this field. from gluon.contrib.login_methods.oauth10a_account import OAuthAccount class LinkedInAccount(OAuthAccount): def get_user(self): import oauth2 as oauth if self.accessToken() is None: return None else: client = oauth.Client(self.consumer, self.accessToken()) resp, content = client.request('https://api.linkedin.com/ v1/people/~:(id,first-name,last-name)') if resp['status'] != '200': return None # TODO: check status; cannot get user info from gluon.contrib.login_methods.linkedin import Profile p = Profile() profile = p.create(content) # email must be unique return dict(first_name=profile.first_name, last_name=profile.last_name, registration_id=profile.id, registration_key=profile.id, email=profile.id) On Oct 28, 4:25 pm, Carl carl.ro...@gmail.com wrote: I am trying to add a registration step when users login using OAuth (LinkedIn in my example). a) am I taking a good approach? b) why am I getting an exception when I try to write to my user table? From db.py: auth.settings.table_user = db.define_table( auth.settings.table_user_name, db.Field('email', 'string', length=254, unique=True, notnull=True, required=True, requires = [IS_LOWER(), IS_EMAIL(), IS_NOT_IN_DB(db,'%s.email'%auth.settings.table_user_name)]), db.Field('password', 'password', length=512, readable=False, label='Password', requires = [CRYPT(key='***')]), db.Field('registration_id', length=512, writable=False, readable=False, default=''), db.Field('registration_key', length=512, writable=False, readable=False, default=''), db.Field('first_name', 'string', length=128), db.Field('last_name', 'string', length=128)) The rest is in default.py: def user: auth.settings.login_next = URL(r=request,f='registerLinkedInAgent') auth.settings.login_form=LinkedInAccount(globals(),CLIENT_ID,CLIENT_SECRET, AUTH_URL, TOKEN_URL, ACCESS_TOKEN_URL) return dict(form=auth()) I won't include LinkedInAccount() here but the issue I have is in registerAgent(form) def registerLinkedInAgent(): if auth.user.registration_key and len(auth.user.registration_key): auth.add_membership(auth.id_group( 'agent'), auth.user.id) # here I do my once-on-registration calls do_registration_stuff() # find current user's record and update registration key to an empty string so this code isn't called again users = db(db.auth_user.id==auth.user.id).select(db.auth_user.ALL) if users and len(users): users[0].update_record({'registration_key''}) redirect(URL('account')) The problem is I get ValueError: need more than 1 value to unpack . Full trackback is below: Traceback (most recent call last): File E:\projects\workspace\TestEnvoy\web2py\gluon\restricted.py, line 188, in restricted exec ccode in environment File E:/projects/workspace/TestEnvoy/web2py/applications/init/ controllers/default.py, line 1528, in module File E:\projects\workspace\TestEnvoy\web2py\gluon\globals.py, line 96, in lambda self._caller = lambda f: f() File E:/projects/workspace/TestEnvoy/web2py/applications/init/ controllers/default.py, line 1132, in registerLinkedInAgent users[0].update_record({'registration_key' : ''}) File E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py, line 3381, in lambda colset.update_record = lambda _ = (colset, table, id), **a: update_record(_, a) File E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py, line 3508, in update_record (colset, table, id) = pack ValueError: need more than 1 value to unpack If anyone needs greater explanation please complain and I'll add more! :)
[web2py] still stuck with services and authentication
I am very confused. I have a simple service 'getmeetings' which is decorated as XMLRPC. The call also requires authorization and basic authorization is enabled in db.py. Here is what happens 1) When run locally on my dev machine - everything works, if i sent in valid id and pw i get results AND if i send in invalid password i get a 303 indicating no aurthorization. 2) When i run on the production machine (linux+apache) - i always get 303 even when sending in valid ID and pw. If i remove the auth- required decorator the service gets invoked. I think this implies a problem with the authorization, possibly due to some environmental setting. I am stuck and unable to figure this out. Any ideas would be greatly appreciated. here is the original post: http://groups.google.com/group/web2py/browse_thread/thread/fea1decf09348144#
Re: [web2py] Re: web2py arguments syntax
Very Cool! At least my code served to awaken the idea of something new! 2010/10/28 Vinicius Assef vinicius...@gmail.com Nice. :-D On Thu, Oct 28, 2010 at 11:20 AM, mdipierro mdipie...@cs.depaul.edu wrote: Out of the box you can do: @service.run def insertdog(name,owner,age): # other things and in routes: routes_in=[ ('/app/default/insertdog/$name/$age/$owner', '/app/default/call/run/insertdog/$name/$age/$owner')] I guess we can make another decorator that automatically registers the routes. On Oct 28, 3:39 am, cjrh caleb.hatti...@gmail.com wrote: On Oct 28, 9:53 am, cjrh caleb.hatti...@gmail.com wrote: On Oct 27, 5:43 pm, VP vtp2...@gmail.com wrote: @app.route('/insertdog/name/age/owner') def insertdog(name,owner,age): # other things For fun, I tried an experiment with decorators. Hold onto your seats: Naturally, this closer simulation of app.route syntax also works (but I think the former separate arguments form works better): class R(object): pass request = R() request.args=['caleb', 100] def validator(route): args = route.split('/')[2:] args = [i.replace('', '').replace('', '') for i in args] assert(len(args)==len(request.args)) def inner(f): for name, value in zip(args, request.args): setattr(f, name, value) return f return inner @validator('/controller_action/first_name/age') def controller_action(): return f.first_name, f.age print f() == OUTPUT: ('caleb', 100) -- http://rochacbruno.com.br
[web2py] Re: Static folder and cookies
Thadeus, Thanks for your reply. It is referring to the root domain having a cookie, in this case, navigating to www.mydomain.comgives a cookie. so this benchmark website is not 100% smart about the fact if cookies are sent with static files. I'll keep that in mind next time I visit the tool. If you really want to, set up an apache domain to serve static files as like static.mydomain.com, and then use web2py routes to redirect to the correct static subdomain. I don't really want to ... so I'll stick to static files in web2py's static folder. Kind regards, Annet
[web2py] Re: IMG helper and attributes
Hi David, Problem solved. thanks. Annet.
[web2py] Re: web2py arguments syntax
On Oct 28, 1:53 am, cjrh caleb.hatti...@gmail.com wrote: On Oct 27, 5:43 pm, VP vtp2...@gmail.com wrote: def insertdog(): name, owner, age = request.args I am unconvinced the other way is better. I haven't tested this, and correct me if I am wrong but this is equivalent to name, owner, age = request.args[0], request.args[1], request.args[2] request.args[0] doesn't have the nice features of request.args(0). The other way is more natural because controller's arguments correspond exactly to functions' arguments in Python. It's conceptually better. Now, controller functions have no, in fact cannot have, arguments. This I think is strange.
[web2py] web2py sandbox
Since Shell does not works on http://web2py.com/demo_admin/shell/index/demo_app I am thinking on how can I implement a web2py interactive shell, running on GAE? I teach web2py for 3 schools and almost one in company training by week, so I always need to explain some example for the students, but now, I am starting my Online Course and I want to have a Online Shell for students to test the output of web2py Helpers and API. I like this kind of example: http://ironpython.net/ironpython/try/ http://tryruby.org/ http://try.mongodb.org/ Anyone knows how we can do a free online web2py Shell running on GAE? (even if we need limitations) if GAE does not allow that, I can run on My own server under a virtualenv of webfaction. I am trying, if anyone can help, this could be useful for everyone. Tks
Re: [web2py] Re: web2py arguments syntax
On Thu, Oct 28, 2010 at 7:53 PM, VP vtp2...@gmail.com wrote: The other way is more natural because controller's arguments correspond exactly to functions' arguments in Python. It's conceptually better. Now, controller functions have no, in fact cannot have, arguments. This I think is strange. If you've followed this thread carefully, you'd have noticed your obvious error. Check the posts and you'll find instructions on how to modify your routes so you can have controller functions with arguments. It's not automatic, and Massimo suggested that he might automate this in future, but the solution he posted is as good as any other out there. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] jQuery Tools
I am using jQuery tools with web2py I think it is the best/easiest way to have a great visual style for tabs, menus, datepickers etc Could be useful for someone else: http://flowplayer.org/tools/index.html Demos: http://flowplayer.org/tools/demos/index.html
Re: [web2py] jQuery Tools
Nice lib! Thanks Richard On Thu, Oct 28, 2010 at 3:23 PM, Bruno Rocha rochacbr...@gmail.com wrote: I am using jQuery tools with web2py I think it is the best/easiest way to have a great visual style for tabs, menus, datepickers etc Could be useful for someone else: http://flowplayer.org/tools/index.html Demos: http://flowplayer.org/tools/demos/index.html
Re: [web2py] jQuery Tools
On Thu, Oct 28, 2010 at 9:31 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Nice lib! Thanks Richard Damn right! Awesome stuff. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] Re: forms2pdf: new free web2py appliance
LOL, I think I found the problem, I was using pdflatex.py from Scons which I tried placing in gluon/contrib and site-packages. Now I am thinking I need to install Latex to get the correct version of pdflatex.py. Does this sound correct? Anyone know of a good latex version for Mac 10.04 Thanks Chris On Oct 27, 9:33 pm, mdipierro mdipie...@cs.depaul.edu wrote: requires trunk On Oct 27, 11:48 am, Christopher Steel chris.st...@gmail.com 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 mdipie...@cs.depaul.edu wrote: http://web2py.com/appliances/default/show/69
[web2py] Re: Render svg using web2py without js library
can't you just make a view that outputs that static text? and then from there abstract out the variables to use data from the web2py controller? while there are no helpers for SVG generation, there is nothing stopping you from writing raw SVG in a view (or as a string variable that you output using the XML helper so it is not escaped). while i have not used SVG myself, if you were to make some helper methods i'm sure they would be appreciated. cfh On Oct 27, 2:07 pm, Chris Baron topher.ba...@gmail.com wrote: 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=rect1type=svg Can anyone give me an example of how to render this using web2py ? Thanks in advance, Chris Baron
[web2py] Re: TextWidget maximum
That value comes from the default validator for text fields: IS_LENGTH(2**16) To avoid, set it explicitly: requires=IS_LENGTH(your_max_value) On Oct 28, 10:11 am, SergeyPo ser...@zarealye.com wrote: I need to paste large texts into a db table field using appadmin. Table field is defined as 'text' and in MySQL is mapped to 'longtext'. Longtext capacity is 4GB or so... I need to paste approx. 1 Mb of text into the field. When I do it in web2py appadmin I get an error enter from 0 to 65536 characters. I believe this is produced by a widget? How is it possible to disable this limit?
[web2py] Re: TextWidget maximum
try adding an IS_LENGTH() validator to the field and set the max length high enough. i don't know for sure, but it sounds like there is a default max length for text widgets (unless you already have a validator that is limiting the size) On Oct 28, 7:11 am, SergeyPo ser...@zarealye.com wrote: I need to paste large texts into a db table field using appadmin. Table field is defined as 'text' and in MySQL is mapped to 'longtext'. Longtext capacity is 4GB or so... I need to paste approx. 1 Mb of text into the field. When I do it in web2py appadmin I get an error enter from 0 to 65536 characters. I believe this is produced by a widget? How is it possible to disable this limit?
[web2py] Re: web2py sandbox
MY goal is to make the existing online shell that works on web2py admin interface, to be free accessible by averyone to test the output of web2py Helpers and API objects, even, DAL working in a memory or session instance. I dont know if this is possible to do on GAE, and how to give multiple user access to this. sometimes we want to see what will be the output for example on : DIV(UL(*[LI('xpto') for n in range(1,100)])) or teaching, we need to explain how web2py API works, we could have a permalink to stored examples as this one. This kind of tool will hellp to show the power of web2py API even for the users who does not knows every possibility of API. The questions: 1: Is it possible on GAE? (if not, no problem I can host) 2: Is it safe? how to make it safe? 3: Can we have multi access? 2010/10/28 Bruno Rocha rochacbr...@gmail.com Since Shell does not works on http://web2py.com/demo_admin/shell/index/demo_app I am thinking on how can I implement a web2py interactive shell, running on GAE? I teach web2py for 3 schools and almost one in company training by week, so I always need to explain some example for the students, but now, I am starting my Online Course and I want to have a Online Shell for students to test the output of web2py Helpers and API. I like this kind of example: http://ironpython.net/ironpython/try/ http://tryruby.org/ http://try.mongodb.org/ Anyone knows how we can do a free online web2py Shell running on GAE? (even if we need limitations) if GAE does not allow that, I can run on My own server under a virtualenv of webfaction. I am trying, if anyone can help, this could be useful for everyone. Tks -- http://rochacbruno.com.br
[web2py] Re: jQuery Tools
I've been using jQuery UI stuff but these look like they are worth a try. Thanks for the link. On Oct 28, 1:23 pm, Bruno Rocha rochacbr...@gmail.com wrote: I am using jQuery tools with web2py I think it is the best/easiest way to have a great visual style for tabs, menus, datepickers etc Could be useful for someone else:http://flowplayer.org/tools/index.html Demos:http://flowplayer.org/tools/demos/index.html
[web2py] Re: jQuery Tools
I've been using jQuery UI but these look very cool. Thanks for the link. -Rip PS I must have hit reply to author on my previous try at responding to this post. On Oct 28, 1:23 pm, Bruno Rocha rochacbr...@gmail.com wrote: I am using jQuery tools with web2py I think it is the best/easiest way to have a great visual style for tabs, menus, datepickers etc Could be useful for someone else:http://flowplayer.org/tools/index.html Demos:http://flowplayer.org/tools/demos/index.html
Re: [web2py] Re: jQuery Tools
On Thu, Oct 28, 2010 at 11:59 PM, RipRyness ripryn...@gmail.com wrote: PS I must have hit reply to author on my previous try at responding to this post. It was ok the first time, though. :) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] Re: forms2pdf: new free web2py appliance
To answer my own question on mac osx the binary (not a python script!) gets installed to /usr/texbin/pdflatex. On Oct 28, 4:52 pm, Christopher Steel chris.st...@gmail.com wrote: LOL, I think I found the problem, I was using pdflatex.py from Scons which I tried placing in gluon/contrib and site-packages. Now I am thinking I need to install Latex to get the correct version of pdflatex.py. Does this sound correct? Anyone know of a good latex version for Mac 10.04 Thanks Chris On Oct 27, 9:33 pm, mdipierro mdipie...@cs.depaul.edu wrote: requires trunk On Oct 27, 11:48 am, Christopher Steel chris.st...@gmail.com 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 mdipie...@cs.depaul.edu wrote: http://web2py.com/appliances/default/show/69
Re: [web2py] possible to alias a field?
On 10/28/2010 1:54 AM, Andrew Thompson wrote: 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. I went with this, generating a real list instead of passing along a resultset: allplaced = [x.machine for x in db(db.mol.removed==None).select()] Oh, and i'm using SQLFORM.factory, so web2py isn't trying to figure out this magic each time. -- Andrew Thompson http://aktzero.com/
[web2py] Re: still stuck with services and authentication
how are you passing along requests from apache to web2py ? can you monitor if web2py actually receive all the headers you send ? something like def test(): with os.open(path/to/file, 'wb') as g: for k,v in request.env.iteritems(): if k.startswith('http_'): g.write(%s: %s % (k,v)) in your controller should be enough. try to call app/controller/test with username and password and go to see the log... On Oct 28, 5:47 pm, david.waldrop david.wald...@gmail.com wrote: I am very confused. I have a simple service 'getmeetings' which is decorated as XMLRPC. The call also requires authorization and basic authorization is enabled in db.py. Here is what happens 1) When run locally on my dev machine - everything works, if i sent in valid id and pw i get results AND if i send in invalid password i get a 303 indicating no aurthorization. 2) When i run on the production machine (linux+apache) - i always get 303 even when sending in valid ID and pw. If i remove the auth- required decorator the service gets invoked. I think this implies a problem with the authorization, possibly due to some environmental setting. I am stuck and unable to figure this out. Any ideas would be greatly appreciated. here is the original post:http://groups.google.com/group/web2py/browse_thread/thread/fea1decf09...
[web2py] Re: still stuck with services and authentication
not that I don't trust webfaction setup scripts, but there are a few shortcomings in passing along the auth headers fcgi to say one needs an extra parameter. Niphlod On Oct 29, 1:00 am, Niphlod niph...@gmail.com wrote: how are you passing along requests from apache to web2py ? can you monitor if web2py actually receive all the headers you send ? something like def test(): with os.open(path/to/file, 'wb') as g: for k,v in request.env.iteritems(): if k.startswith('http_'): g.write(%s: %s % (k,v)) in your controller should be enough. try to call app/controller/test with username and password and go to see the log... On Oct 28, 5:47 pm, david.waldrop david.wald...@gmail.com wrote: I am very confused. I have a simple service 'getmeetings' which is decorated as XMLRPC. The call also requires authorization and basic authorization is enabled in db.py. Here is what happens 1) When run locally on my dev machine - everything works, if i sent in valid id and pw i get results AND if i send in invalid password i get a 303 indicating no aurthorization. 2) When i run on the production machine (linux+apache) - i always get 303 even when sending in valid ID and pw. If i remove the auth- required decorator the service gets invoked. I think this implies a problem with the authorization, possibly due to some environmental setting. I am stuck and unable to figure this out. Any ideas would be greatly appreciated. here is the original post:http://groups.google.com/group/web2py/browse_thread/thread/fea1decf09...
[web2py] Re: still stuck with services and authentication
not that I don't trust webfaction setup scripts, but there are a few shortcomings in passing along the auth headers fcgi to say one needs an extra parameter. I forgot that maybe it will be easier to set up a page def test(): heads = [(- %s: %s %(k,v)) for k,v in request.env.iteritems() if k.startswith('http_')] return ('\n').join(heads) and try to retrieve the page with urllib.urlopen with user and pass and see the output. Niphlod On Oct 29, 1:00 am, Niphlod niph...@gmail.com wrote: how are you passing along requests from apache to web2py ? can you monitor if web2py actually receive all the headers you send ? something like def test(): with os.open(path/to/file, 'wb') as g: for k,v in request.env.iteritems(): if k.startswith('http_'): g.write(%s: %s % (k,v)) in your controller should be enough. try to call app/controller/test with username and password and go to see the log... On Oct 28, 5:47 pm, david.waldrop david.wald...@gmail.com wrote: I am very confused. I have a simple service 'getmeetings' which is decorated as XMLRPC. The call also requires authorization and basic authorization is enabled in db.py. Here is what happens 1) When run locally on my dev machine - everything works, if i sent in valid id and pw i get results AND if i send in invalid password i get a 303 indicating no aurthorization. 2) When i run on the production machine (linux+apache) - i always get 303 even when sending in valid ID and pw. If i remove the auth- required decorator the service gets invoked. I think this implies a problem with the authorization, possibly due to some environmental setting. I am stuck and unable to figure this out. Any ideas would be greatly appreciated. here is the original post:http://groups.google.com/group/web2py/browse_thread/thread/fea1decf09...
[web2py] Re: Some beginner questions on form
On 27 oct, 23:10, mdipierro mdipie...@cs.depaul.edu wrote: Field('name',requires=IS_IN_SET(('value1,'value2',value3'))) This is cool. Can I have valuex in the db while presenting something else to the user (I want to value in my db to be always in English but I need to translate these values for the user) without having to do a conversion function that will translate values send my the form to English?
[web2py] Looking for a developer - Web2py and Google App engine simple project
Hello I am looking for a developer to develop a simple web2py and google app engine project. Requirement : 1. Users login using Google account and click a few check boxes, that increases or decreases their points. 2. An Admin interface provides a view of the users, and their points.
[web2py] Quiet here tonight
Massimo, your users of web2py wish you a safe and successful trip spreading the good word about web2py.
Re: [web2py] Quiet here tonight
+1 have fun. Be nice to all those other frameworks. :) On Thu, 2010-10-28 at 22:34 -0700, ron_m wrote: Massimo, your users of web2py wish you a safe and successful trip spreading the good word about web2py. attachment: face-smile.png