Re: [web2py] Re: LOAD: ajax_trap errors... (still in 1.96.1)
tracked in http://code.google.com/p/web2py/issues/detail?id=284 On Fri, Jun 3, 2011 at 1:44 AM, ron_m ron.mco...@gmail.com wrote: I figured out the problem. The Javascript generated looks like this: web2py_trap_form('('/app/default/testajax.load',)','c831268503949'); which is illegal because the single quotes around the URL terminate the single quotes of the first parameter for web2py_trap_form It looks like a string '(' then /app/default. is no longer inside quotes. Line 148 of compileapp.py in version 1.96.1 has the line js = web2py_trap_form('%s','%s'); % (link, target) I traded the quotes around in the Python code like so js = 'web2py_trap_form(%s,%s);' % (link, target) so the output would change to look like web2py_trap_form(('/app/default/testajax.load',),c831268503949); which is legal Javascript and now I get no errors. A second question is why the link is a set, the output formating seems to indicate that. I don't know enough to know whether the first element should be dereferenced e.g. link[0] instead of just link. Then there would not be 2 sets of single quotes atcked in the output. Ron -- Sebastian E. Ovide
Re: [web2py] Error With Plugin Wiki
You have the last web2py installed? 2011/6/3 joseph simpson jjs0...@gmail.com I am just starting to use the plugin wiki. Simple text pages appear to work, but the jqgrid component gives the error documented in the attached screen shot. Any ideas on what I am doing wrong? Thanks for your help, Joe -- Joe Simpson Sent From My DROID!! -- http://martin.tecnodoc.com.ar
[web2py] Re: Social network plug-in
I can answer 4). 'friendship' is an Ajax callback defined later on. The only problem with this otherwise excellent video is that sometimes we cannot see the ends of the lines. For example around 9:50 (at the end of the URL). François On 3 juin, 02:02, François gustave5...@gmail.com wrote: I have a few questions on the code. 1) The myfriends table is defined as : myfriends = db(Link.source==me)(Link.accepted==True) But if someone asks for my friendship and I accept, then he won't be in myfriends until I ask myself for his friendship (and he accepts). Am I right ? Maybe we could do two queries and unite them with lambda a,b:ab ? 2) There are many functions which end with : return locals() Does it return all the local variables defined in the function ? 3) Although I know what the result is, I don't understand the logic of this query : # list all friendship requests we received friends = db(User.id==Link.source) (Link.target==me).select(orderby=alphabetical) What I don't understand is that the query deals with two different tables. 4) Then all that ajax is Chinese for me ;) button onclick=ajax('{{=URL('friendship',args=('request',user.id))}}', [,null);$(this).parent().html('pending')request friendship/button Where was the 'friendship' of the URL defined ? Thanks to anybody who answers part of these questions, François On 2 juin, 23:03, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I have it somewhere. I will post it on web2py appliances asap. On Jun 2, 3:06 pm, François gustave5...@gmail.com wrote: Thank you, this is nice and impressive ! Is there a place where I can download the code ? François On 2 juin, 17:57, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Something like this?http://vimeo.com/21364178 On Jun 2, 10:09 am, François gustave5...@gmail.com wrote: Hello everybody, Is there a social network plug-in for Web2py, which for example allows users to send messages to each other ? Thank you very much, François- Masquer le texte des messages précédents - - Afficher le texte des messages précédents -- Masquer le texte des messages précédents - - Afficher le texte des messages précédents -- Masquer le texte des messages précédents - - Afficher le texte des messages précédents -
[web2py] Re: template in crud
i will go for the controller version. thanks a lot. On Jun 2, 3:14 am, Richard Vézina ml.richard.vez...@gmail.com wrote: You have typo.. (see quote in red) Why do you want to do that like this? In controller you could go like this : db.tablename.fieldname.readable = True or False If you need to hide field base on user group membership you will have to define the readable/writable field for each group in your function... You could also use function decorators and CRUD... Richard On Mon, May 30, 2011 at 10:16 AM, max dulip.withan...@gmail.com wrote: Hi all, I have been searching for a customizable way to select and deselect fields. i have found this way tempate_01 = {'myfiled':False, 'myscofield':True} read this values in the db defitionion. Field('myfield', type='text',readable=template_01['myfiled']), is this a good way to do this? Because i generally don't like writing lots of global variables, thanks
[web2py] components in related tables
hi, is it possible to use components in related tables? lets say like the blog that have a comment related, i want to make the comment as a components that can be use in list index and show itself. thank you so much before. e.g. === index.html === {{extend 'layout.html'}} {{for i, row in enumerate(rows):}} {{if i == items_per_page: break}} {{=DIV(A(row.title, _href = URL(show_link, args = row.id), _title = row.title))}} {{=DIV(row.content)}} {{=LOAD('default', 'blog_comment_show.load', ajax = True)}} {{=LOAD('default', 'blog_comment_add.load', ajax = True, target = 'blog_comment_show')}} {{=BR()}} {{pass}} {{if page:}} {{=A(T('Previous'), _href = URL(args = [page - 1]), _title = T('Previous'))}} {{pass}} {{if len(rows) items_per_page:}} {{=A(T('Next'), _href = URL(args = [page + 1]), _title = T('Next'))}} {{pass}} === blog_comment_show.load === {{if len(results):}} {{=DIV(A(T('View Comments (%s)' % len(results)), _href = '#'), _id = 'view')}} div class = comments hidden {{for blog_comment in results:}} {{=SPAN(db.auth_user[blog_comment.created_by].first_name, T(' on '), blog_comment.created_on, T(' Said '), blog_comment.comment)}} {{pass}} /div {{else:}} {{=DIV(B(T('No Comments Posted Yet')))}} {{pass}} === blog_comment_add.load === {{=SCRIPT(_src = URL('static', 'js/comments.js'))}} {{=DIV(A(T('Post a Comment'), _href = '#'), _class = 'post')}} {{=DIV(form, _class = 'form hidden')}}
[web2py] components in related tables
hi, is it possible to use components in related tables? lets say like a blog with comments related with it. i want to make comments as a components that can be load in index list and blog show page. thank you so much in advance.
[web2py] vps - memory problems
Hi, I'm testing my production environment (vps with ubuntu 10.4 lts lucid, nginx, uwsgi, postgresql, latest web2py), and I detected some memory problems, please check: root@vps:~# htop 1 [|| 1.0%] Tasks: 104 total, 1 running 2 [ 0.0%] Load average: 0.57 0.17 0.04 Mem[|||342/358MB] Uptime: 5 days, 05:55:08 Swp[ 297/1023MB] PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 25948 www-data 20 0 124M 932 412 S 0.0 0.3 0:01.31 `- /usr/bin/uwsgi-python --master --no-orphans --processes 2 --logdate --chmod-socket=660 --uid www-data --gid www-data --daemonize /var/log/uwsgi-python/web2py.log --pidfile 25963 www-data 20 0 393M 88796 2124 D 0.0 24.2 0:12.39 | `- /usr/bin/uwsgi-python --master --no-orphans --processes 2 --logdate --chmod-socket=660 --uid www-data --gid www-data --daemonize /var/log/uwsgi-python/web2py.log --pid 25962 www-data 20 0 364M 189M 2116 S 0.0 52.9 0:11.34 | `- /usr/bin/uwsgi-python --master --no-orphans --processes 2 --logdate --chmod-socket=660 --uid www-data --gid www-data --daemonize /var/log/uwsgi-python/web2py.log --pid Why are these processes consuming so much memory?, what are they doing?, why are they not ended?. The performance of my vps was excellent up until these processes ate all the memory. Thanks for your input. Carlos
[web2py] vps - memory problems
Hi, I'm testing my production environment (vps with ubuntu 10.4 lts lucid, nginx, uwsgi, postgresql, latest web2py), and I detected some memory problems, please check: root@vps:~# htop 1 [|| 1.0%] Tasks: 104 total, 1 running 2 [ 0.0%] Load average: 0.57 0.17 0.04 Mem[|||342/358MB] Uptime: 5 days, 05:55:08 Swp[ 297/1023MB] PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 25948 www-data 20 0 124M 932 412 S 0.0 0.3 0:01.31 `- /usr/bin/uwsgi-python --master --no-orphans --processes 2 --logdate --chmod-socket=660 --uid www-data --gid www-data --daemonize /var/log/uwsgi-python/web2py.log --pidfile 25963 www-data 20 0 393M 88796 2124 D 0.0 24.2 0:12.39 | `- /usr/bin/uwsgi-python --master --no-orphans --processes 2 --logdate --chmod-socket=660 --uid www-data --gid www-data --daemonize /var/log/uwsgi-python/web2py.log --pid 25962 www-data 20 0 364M 189M 2116 S 0.0 52.9 0:11.34 | `- /usr/bin/uwsgi-python --master --no-orphans --processes 2 --logdate --chmod-socket=660 --uid www-data --gid www-data --daemonize /var/log/uwsgi-python/web2py.log --pid Why are these processes consuming so much memory?, what are they doing?, why are they not ended?. The performance of my vps was excellent up until these processes ate all the memory. Thanks for your input. Carlos
Re: [web2py] vps - memory problems
Hi, I'm testing my production environment (vps with ubuntu 10.4 lts lucid, nginx, uwsgi, postgresql, latest web2py), and I detected some memory problems, please check: root@vps:~# htop 1 [|| 1.0%] Tasks: 104 total, 1 running 2 [ 0.0%] Load average: 0.57 0.17 0.04 Mem[|||342/358MB] Uptime: 5 days, 05:55:08 Swp[ 297/1023MB] PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 25948 www-data 20 0 124M 932 412 S 0.0 0.3 0:01.31 `- /usr/bin/uwsgi-python --master --no-orphans --processes 2 --logdate --chmod-socket=660 --uid www-data --gid www-data --daemonize /var/log/uwsgi-python/web2py.log --pidfile 25963 www-data 20 0 393M 88796 2124 D 0.0 24.2 0:12.39 | `- /usr/bin/uwsgi-python --master --no-orphans --processes 2 --logdate --chmod-socket=660 --uid www-data --gid www-data --daemonize /var/log/uwsgi-python/web2py.log --pid 25962 www-data 20 0 364M 189M 2116 S 0.0 52.9 0:11.34 | `- /usr/bin/uwsgi-python --master --no-orphans --processes 2 --logdate --chmod-socket=660 --uid www-data --gid www-data --daemonize /var/log/uwsgi-python/web2py.log --pid Add --memory-report to your uWSGI command line. You will get in /var/log/uwsgi-python/web2py.log the memory consumed after each request. If there is a leak you should find it preatty easy. -- Roberto De Ioris http://unbit.it
[web2py] Re: web2py 1.96.1 is OUT
some really nice features there that make web2py more like typical python scripts. Fantastic!
[web2py] Re: component refresh with jQuery UI tab plugin
Give a name to your components {{=LOAD(...,target='one')}} {{=LOAD(...,target='two')}} {{=LOAD(...,target='three')}} now any action can trigger a component reload response.js=web2py_component('action','target') where action is the URL of the component and 'target' is 'one', 'two', 'three'', etc. On Jun 2, 4:21 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: Hello, Here my view code : {{extend 'layout_form.html'}} style type=text/css title=currentStyle @import {{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/th emes/base/jquery.ui.all.css')}}; /style script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/js/jquery-1.4.4.m in.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl e/ui/jquery.ui.core.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl e/ui/jquery.ui.widget.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl e/ui/jquery.ui.tabs.js')}}/script script $(function() { $( #tabs ).tabs();}); /script div class=demo br/ br/ br/ div id=tabs ul lia href=#tabs-1{{=T('folder').capitalize()}}/a/li lia href=#tabs-2{{=T('volume').capitalize()}}/a/li lia href=#tabs-3{{=T('tome').capitalize()}}/a/li lia href=#tabs-4{{=T('report').capitalize()}}/a/li /ul div id=tabs-1 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_fnaregistry',extension='load',aja x=True,ajax_trap=False)}} /div!-- tabs-1 -- div id=tabs-2 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_vregistry',extension='load',ajax= True,ajax_trap=False)}} /div!-- tabs-2 -- div id=tabs-3 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_tregistry',extension='load',ajax= True,ajax_trap=False)}} /div!-- tabs-3 -- div id=tabs-4 br/ {{=LOAD(c='ref',f='create_fvte',args='ref_eregistry',extension='load',ajax= True,ajax_trap=False)}} /div!-- tabs-4 -- /div!-- tabs -- /div!-- End demo -- The problem is that when the form loaded with component in tab-1 is submited and the user clic on tab-2 to fill the following form... The component is not up to date... So the new entry just made into the preceding form is not available to be pick in the second form dropbox... Is there a way to send a refresh component command on tab-2 clic or something?? Or the only solution be to add a refresh button that to force component reload?? Thanks Richard
[web2py] Re: single virtual field definition for multiple table
db.define_table('itemx', Field('unit_price','double'), Field('quantity','integer'), db.define_table('itemy', Field('unit_price','double'), Field('quantity','integer'), class MyVirtualFields(object): def __init__(self,table): self.table=table def total_price(self): record = getattr(self,self.table) return record.unit_price*record.quantity db.itemx.virtualfields.append(MyVirtualFields('itemx')) db.itemy.virtualfields.append(MyVirtualFields('itemy')) On Jun 2, 4:37 pm, Manuele Pesenti manuele.pese...@gmail.com wrote: what if I want to define a virtual field and use it for different table with same field names that I want to use in the virtual field calculation? Do I have to cut paste and chance only the table name in the formula or there's a modular way to do it? thanks a lot Manuele
[web2py] Re: versioning and uploads
in trunk. thanks On Jun 2, 5:39 pm, Joseph.Piron joseph.pi...@gmail.com wrote: The one created in the application folder when using the web interface versioning option. Haven't even noticed the distro one. What is its purpose ? On May 31, 5:19 pm, pbreit pbreitenb...@gmail.com wrote: Which .hgignore? The main distro includes: applications/*/uploads/* http://code.google.com/p/web2py/source/browse/.hgignore#45
[web2py] Re: Web2py and PyScripter debugging
### no_threads_web2py.py ### from wsgiref.simple_server import make_server, demo_app from gluon import wsgibase httpd = make_server('', 8000, wsgibase) print Serving HTTP on port 8000... # Respond to requests until process is killed httpd.serve_forever() ### end file ### On Jun 3, 12:07 am, Dmitriy partsyr...@gmail.com wrote: Is there any way to execute web2py in one (main) thread? If not, can it be added? This can help to debug web2py in PyScripter. PyScripter is great IDE for Windows, but currently support only single-thread debugging. A '-n 1' command line option doesn't help. Thanks!
[web2py] components in related tables
You need to pass an I'd to show controller so it knows what comments to pull.
Re: [web2py] What is the point of CRUD?
I didn't look into the code but it looks like CRUD extends SQLFORM... so it is your choice in using SQLFORM and do few things by hand, or use CRUD and create a prototype in less lines and therefore in less time !... On Thu, Jun 2, 2011 at 11:50 AM, apple simo...@gmail.com wrote: In previous post it was stated that CRUD was more for prototyping and SQLFORM for when you need more control. However now I see that there is some additional functionality in CRUD e.g. the link with the auth module; and archiving of records. It seems to me these are two separate ways of doing the same thing but with slightly different interfaces. Quite confusing. I wonder why the CRUD functionality was not just incorporated into SQLFORM rather than creating a separate interface? Personally I would rather stick with one or the other because it is easier to remember the quirks and names of parameters. Should I choose SQLFORM as it allows most flexibility or CRUD as this will ultimately have greater functionality? -- Sebastian E. Ovide
[web2py] Re: LOAD: ajax_trap errors... (still in 1.96.1)
fixed. there was an unwanted comma in the code. On Jun 3, 3:16 am, Sebastian E. Ovide sebastian.ov...@gmail.com wrote: tracked inhttp://code.google.com/p/web2py/issues/detail?id=284 On Fri, Jun 3, 2011 at 1:44 AM, ron_m ron.mco...@gmail.com wrote: I figured out the problem. The Javascript generated looks like this: web2py_trap_form('('/app/default/testajax.load',)','c831268503949'); which is illegal because the single quotes around the URL terminate the single quotes of the first parameter for web2py_trap_form It looks like a string '(' then /app/default. is no longer inside quotes. Line 148 of compileapp.py in version 1.96.1 has the line js = web2py_trap_form('%s','%s'); % (link, target) I traded the quotes around in the Python code like so js = 'web2py_trap_form(%s,%s);' % (link, target) so the output would change to look like web2py_trap_form(('/app/default/testajax.load',),c831268503949); which is legal Javascript and now I get no errors. A second question is why the link is a set, the output formating seems to indicate that. I don't know enough to know whether the first element should be dereferenced e.g. link[0] instead of just link. Then there would not be 2 sets of single quotes atcked in the output. Ron -- Sebastian E. Ovide
[web2py] Show animated gif to submit
Hello, I need to display a message or an animated gif to submit, similar to this [1]. I do not know how to do is put in the INPUT type=submit the function call (javascript) onclick=javascript:animatedcollapse.toggle('uploading') INPUT type=submit name=upload value=Continue onclick=javascript:animatedcollapse.toggle('uploading') This is using crud or SQLFORM. I know I can create the form manually, but I still use crud or SQLFORm. Best Regards, Jose [1] http://forums.devshed.com/javascript-development-115/on-form-submit-fade-out-screen-and-display-animated-loading-784875.html
[web2py] Re: Size of the list:string input box
thanks. On May 21, 5:14 pm, Anthony abasta...@gmail.com wrote: On Saturday, May 21, 2011 3:56:13 AM UTC-4, max wrote: I am using the list string to enter data where the number of input texts. Can I customize the size of the input boxes in one form because i am inserting large texts? Can't use the type 'text' because the number of entries is not previuosly known. You should be able to handle that with CSS -- seehttp://web2py.com/book/default/chapter/07#CSS-Conventions. Anthony
[web2py] splitting the field values of a list:string field
I have the following use case. -- User has to input a unknown number of strings in a pref-defined format. eg. a#b#c , a1#b1#c1, a2#b1#c2 Currently i am using the list:string and allow the user to directly add the string with a hash sign. But I would prefer to format the input like this, myfield: name [a1] name2 [b1] name3 [c1] where the [] are input fields of a form horizontally. and the + sign of the web2py list adds more from the same format. For me it is ok. that everything in the myfield is saved in the |a|b| c| format. thanks for any ideas.
[web2py] BUG?: Funny Bug with LOAD;
Maybe its not a bug; But I found a strange behavior; I am using LOAD to load some views; I also use @auth.requires_login() I just saw that If I try to reload the component after the session expires the component loads the login page where the component should go; Perhaps once the session expires; we should force the whole page to be redirected? Any thoughts? Thanks.
[web2py] web2py 1.96.2 is OUT security warning
We fixed a few more bugs (strangely most of them preexisting 1.96.1). We also addressed two security issues as I will explain later in this email: here is am reporting the 1.96.1 changelog with some additions Changelog: - from gluon import * imports in every python module a web2py environment (A, DIV,..SQLFORM, DAL, Field,...) including current.request, current.response, current.session, current.T, current.cache, thanks Jonathan. - conditional models in models/controller/a.py and models/controller/function/a.py - from mymodule import *, looks for mymodule in applications/thisapp/ modules first and then in sys.path. No more need for local_import. Thanks Pierre. - usage of generic.* views is - by default - restricted to localhost for security. This can be changed in a granular way with: response.generic_patterns=['*']. This is a slight change of behavior for new app but a major security fix. - all applications have cas 2.0 provider at http://.../user/cas/login - all applications can delegate to login to external provider Auth(...,cas_provider='http://.../other_app/default/user/cas') - A(...,callback=URL(...),larget='id') does Ajax - URL(...,user_signature=True), LOAD(...,user_signature=True) can sign urls and @auth.requires_signature() will check the signature for any decorated action. - DAL(...,migrate_enabled=False) to disable all migrations - DAL(...,fake_migrate_all=True) to rebuild all corrupted metadata - new DAL metadata format (databases/*.table) - DAL(...,adapter_arg={}) allows support for alternate drivers - DAL now allows circular table defintions - DAL(..,auto_import=True) automatically imports tables from metadata without need to db.define_table(...)s. - new alterante syntax for inner joins: db(...).select(join=...) - experimental cubrid database support - DAL 'request_tenant' fields are special, the altomatically filer all records based on their default value. - db._common_fields.append(Field('owner')) allows to add fields to ALL tables - DAL ignores repeated fields with same names - web2py_ajax.html is more modular, thanks Anthony - request.is_local - request.is_http - new sessions2trash.py thanks Jim Karsten - corrupted cache files are automatically deleted - new simpler API gluon.contrib.AuthorizeNet.procss(...) - fixed recaptcha (as they released new API) - messages in validators have default internationalization - No more Auth(globals(),db), just Auth(db). Same for Crud and Service. - scripts/access.wsgi allows apache+mod_wsgi to delegate authentication of any URL to any web2py app - json now supports T(...) - scripts/setup-web2py-nginx-uwsgi-ubuntu.sh - web2py HTTP responses now set: X-Powered-By: web2py, thanks Bruno - mostly fixed generic.pdf. You can view any page in PDF if you have pdflatex installed or if your html follows the pyfpdf convention. - auth.settings.extra_fields['auth_user'].append(Field('country')) allows to extend auth_* tables without need of definiting a custom auth_* table. Must be placed before auth.define_tables() - {{=response.toolbar()}} to help you debug applications - web based shell now supports object modifications (but no redefinitions of non-serializable types) - jQuery 1.6.1 - more secure uuid function to protect sessions form cryptographic attacks - auto logout of appadmin - Lots of bug fixes ## Security wanring This release fixes two security issues: 1) web2py used random to generate uuid. This is mostly fine but it was technically possible for an attacker to retrieve a lot of session uuids, extrapolate information about the pseudo-random-generator and use the information to guess somebody else's session. Our new contributor and security expert David Wager, spotted this problem and suggested rewriting the web2py uuid function used for generating session names. The new function uses /dev/urandom as entropy source and falls back to the old method when the entropy source is not available, issuing a warning. 2) appadmin uses admin authentication but failed to detect expires sessions (60minutes). This has now been corrected.
[web2py] Noob - Using DAL outside of web2py
Hi Just starting with web2py. I've been using TurboGears (w/ SQLObject) for many years and am excited about the things that web2py has to offer. On to my question... I have a need to use the DAL outside of web2py. I found the following in the manual... from gluon.shell import exec_environment cas = exec_environment('applications/cas/models/db.py') rows = cas.db().select(cas.db.user.ALL) I've modified it a bit and came up with... import sys sys.path.append('w:/web2py/library.zip') from gluon.shell import exec_environment ic = exec_environment('/applications/InfoCenter/models/db.py') rows = ic.db().select(ic.db.auth_user.ALL) for row in rows: print row ...but am getting the following: Traceback (most recent call last): File C:/dev/miscellaneous/playground/dalOutside.py, line 4, in module ic = exec_environment('/applications/InfoCenter/models/db.py') File gluon/shell.py, line 60, in exec_environment File gluon/compileapp.py, line 230, in build_environment File gluon/cache.py, line 371, in __init__ File gluon/cache.py, line 229, in __init__ WindowsError: [Error 3] The system cannot find the path specified: 'applications\\InfoCenter\\cache' Any clues to what I should be looking at? Thanks! -Jim
[web2py] Bug with list:string in gae
There is a problem of encoding, to write data to fields of type list:string in gae. When we have a field of type list: string and try to write data in this field, the method represents web2py run () class NoSQLAdapter (), is present in web2py/gluon/dal.py, and str (x) in line 2633. However the environment gae (SDK), will run unicode (value). encode ('utf-8') Look at the example: # In web2py def w2p(x): ... ... executed in the method represent() ... ... return str(x) # In gae def gae(value): ... ... Implemented in gae before saving ... ... return unicode(value).encode('utf-8') Thus, the instructions will cause an error when we try to enter accented characters in this field, no matter how we send data to write in this field. The errors presented are: Example 1 - error in gae(): x = 'ãé' value = w2p(x) gae(value) Traceback (most recent call last): File input, line 1, in module File input, line 3, in gae UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128) Example 2 - error in web2py: x = 'ãé' x = 'ãé'.decode('utf-8') value = w2p(x) Traceback (most recent call last): File input, line 1, in module File input, line 6, in w2p UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
[web2py] Re: Noob - Using DAL outside of web2py
no, please do not use exec_environment. from gluon import DAL db = DAL('sqlite://',folder='/your/app/ databases',auto_import=True) print db.tables On Jun 3, 9:27 am, j...@qlf.com j...@qlf.com wrote: Hi Just starting with web2py. I've been using TurboGears (w/ SQLObject) for many years and am excited about the things that web2py has to offer. On to my question... I have a need to use the DAL outside of web2py. I found the following in the manual... from gluon.shell import exec_environment cas = exec_environment('applications/cas/models/db.py') rows = cas.db().select(cas.db.user.ALL) I've modified it a bit and came up with... import sys sys.path.append('w:/web2py/library.zip') from gluon.shell import exec_environment ic = exec_environment('/applications/InfoCenter/models/db.py') rows = ic.db().select(ic.db.auth_user.ALL) for row in rows: print row ...but am getting the following: Traceback (most recent call last): File C:/dev/miscellaneous/playground/dalOutside.py, line 4, in module ic = exec_environment('/applications/InfoCenter/models/db.py') File gluon/shell.py, line 60, in exec_environment File gluon/compileapp.py, line 230, in build_environment File gluon/cache.py, line 371, in __init__ File gluon/cache.py, line 229, in __init__ WindowsError: [Error 3] The system cannot find the path specified: 'applications\\InfoCenter\\cache' Any clues to what I should be looking at? Thanks! -Jim
Re: [web2py] web2py 1.96.2 is OUT security warning
Updated on pypi -- Praneeth IRC: lifeeth On Fri, Jun 3, 2011 at 8:53 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: We fixed a few more bugs (strangely most of them preexisting 1.96.1). We also addressed two security issues as I will explain later in this email: here is am reporting the 1.96.1 changelog with some additions Changelog: - from gluon import * imports in every python module a web2py environment (A, DIV,..SQLFORM, DAL, Field,...) including current.request, current.response, current.session, current.T, current.cache, thanks Jonathan. - conditional models in models/controller/a.py and models/controller/function/a.py - from mymodule import *, looks for mymodule in applications/thisapp/ modules first and then in sys.path. No more need for local_import. Thanks Pierre. - usage of generic.* views is - by default - restricted to localhost for security. This can be changed in a granular way with: response.generic_patterns=['*']. This is a slight change of behavior for new app but a major security fix. - all applications have cas 2.0 provider at http://.../user/cas/login - all applications can delegate to login to external provider Auth(...,cas_provider='http://.../other_app/default/user/cas') - A(...,callback=URL(...),larget='id') does Ajax - URL(...,user_signature=True), LOAD(...,user_signature=True) can sign urls and @auth.requires_signature() will check the signature for any decorated action. - DAL(...,migrate_enabled=False) to disable all migrations - DAL(...,fake_migrate_all=True) to rebuild all corrupted metadata - new DAL metadata format (databases/*.table) - DAL(...,adapter_arg={}) allows support for alternate drivers - DAL now allows circular table defintions - DAL(..,auto_import=True) automatically imports tables from metadata without need to db.define_table(...)s. - new alterante syntax for inner joins: db(...).select(join=...) - experimental cubrid database support - DAL 'request_tenant' fields are special, the altomatically filer all records based on their default value. - db._common_fields.append(Field('owner')) allows to add fields to ALL tables - DAL ignores repeated fields with same names - web2py_ajax.html is more modular, thanks Anthony - request.is_local - request.is_http - new sessions2trash.py thanks Jim Karsten - corrupted cache files are automatically deleted - new simpler API gluon.contrib.AuthorizeNet.procss(...) - fixed recaptcha (as they released new API) - messages in validators have default internationalization - No more Auth(globals(),db), just Auth(db). Same for Crud and Service. - scripts/access.wsgi allows apache+mod_wsgi to delegate authentication of any URL to any web2py app - json now supports T(...) - scripts/setup-web2py-nginx-uwsgi-ubuntu.sh - web2py HTTP responses now set: X-Powered-By: web2py, thanks Bruno - mostly fixed generic.pdf. You can view any page in PDF if you have pdflatex installed or if your html follows the pyfpdf convention. - auth.settings.extra_fields['auth_user'].append(Field('country')) allows to extend auth_* tables without need of definiting a custom auth_* table. Must be placed before auth.define_tables() - {{=response.toolbar()}} to help you debug applications - web based shell now supports object modifications (but no redefinitions of non-serializable types) - jQuery 1.6.1 - more secure uuid function to protect sessions form cryptographic attacks - auto logout of appadmin - Lots of bug fixes ## Security wanring This release fixes two security issues: 1) web2py used random to generate uuid. This is mostly fine but it was technically possible for an attacker to retrieve a lot of session uuids, extrapolate information about the pseudo-random-generator and use the information to guess somebody else's session. Our new contributor and security expert David Wager, spotted this problem and suggested rewriting the web2py uuid function used for generating session names. The new function uses /dev/urandom as entropy source and falls back to the old method when the entropy source is not available, issuing a warning. 2) appadmin uses admin authentication but failed to detect expires sessions (60minutes). This has now been corrected.
RE: [web2py] Re: Noob - Using DAL outside of web2py
Thanks much for the info. Being new to web2py I don't have a feel for how things happen in the community. I just purchased/printed the book/manual and found this recipe under Core | Execution Environment. I know that I'm using a brand new release. How often do you update the manual? Are there other resources I should be looking at to get started? Not complaining at all, loving the capabilities of the tool and the fact that it is documented at all. -Jim -Original Message- From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of Massimo Di Pierro Sent: Friday, June 03, 2011 10:29 AM To: web2py-users Subject: [web2py] Re: Noob - Using DAL outside of web2py no, please do not use exec_environment. from gluon import DAL db = DAL('sqlite://',folder='/your/app/ databases',auto_import=True) print db.tables On Jun 3, 9:27 am, j...@qlf.com j...@qlf.com wrote: Hi Just starting with web2py. I've been using TurboGears (w/ SQLObject) for many years and am excited about the things that web2py has to offer. On to my question... I have a need to use the DAL outside of web2py. I found the following in the manual... from gluon.shell import exec_environment cas = exec_environment('applications/cas/models/db.py') rows = cas.db().select(cas.db.user.ALL) I've modified it a bit and came up with... import sys sys.path.append('w:/web2py/library.zip') from gluon.shell import exec_environment ic = exec_environment('/applications/InfoCenter/models/db.py') rows = ic.db().select(ic.db.auth_user.ALL) for row in rows: print row ...but am getting the following: Traceback (most recent call last): File C:/dev/miscellaneous/playground/dalOutside.py, line 4, in module ic = exec_environment('/applications/InfoCenter/models/db.py') File gluon/shell.py, line 60, in exec_environment File gluon/compileapp.py, line 230, in build_environment File gluon/cache.py, line 371, in __init__ File gluon/cache.py, line 229, in __init__ WindowsError: [Error 3] The system cannot find the path specified: 'applications\\InfoCenter\\cache' Any clues to what I should be looking at? Thanks! -Jim
[web2py] Re: Bug with list:string in gae
Can you please open a ticket on google code? On Jun 3, 10:16 am, Luciano ldmo...@gmail.com wrote: There is a problem of encoding, to write data to fields of type list:string in gae. When we have a field of type list: string and try to write data in this field, the method represents web2py run () class NoSQLAdapter (), is present in web2py/gluon/dal.py, and str (x) in line 2633. However the environment gae (SDK), will run unicode (value). encode ('utf-8') Look at the example: # In web2py def w2p(x): ... ... executed in the method represent() ... ... return str(x) # In gae def gae(value): ... ... Implemented in gae before saving ... ... return unicode(value).encode('utf-8') Thus, the instructions will cause an error when we try to enter accented characters in this field, no matter how we send data to write in this field. The errors presented are: Example 1 - error in gae(): x = 'ãé' value = w2p(x) gae(value) Traceback (most recent call last): File input, line 1, in module File input, line 3, in gae UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128) Example 2 - error in web2py: x = 'ãé' x = 'ãé'.decode('utf-8') value = w2p(x) Traceback (most recent call last): File input, line 1, in module File input, line 6, in w2p UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
Re: [web2py] Re: Noob - Using DAL outside of web2py
Dont forget to run latest 1.96.2 version... Em 03/06/2011 12:28, Massimo Di Pierro massimo.dipie...@gmail.com escreveu: no, please do not use exec_environment. from gluon import DAL db = DAL('sqlite://',folder='/your/app/ databases',auto_import=True) print db.tables On Jun 3, 9:27 am, j...@qlf.com j...@qlf.com wrote: Hi Just starting with web2py. I've been using TurboGears (w/ SQLObject) for many years and am excited about the things that web2py has to offer. On to my question... I have a need to use the DAL outside of web2py. I found the following in the manual... from gluon.shell import exec_environment cas = exec_environment('applications/cas/models/db.py') rows = cas.db().select(cas.db.user.ALL) I've modified it a bit and came up with... import sys sys.path.append('w:/web2py/library.zip') from gluon.shell import exec_environment ic = exec_environment('/applications/InfoCenter/models/db.py') rows = ic.db().select(ic.db.auth_user.ALL) for row in rows: print row ...but am getting the following: Traceback (most recent call last): File C:/dev/miscellaneous/playground/dalOutside.py, line 4, in module ic = exec_environment('/applications/InfoCenter/models/db.py') File gluon/shell.py, line 60, in exec_environment File gluon/compileapp.py, line 230, in build_environment File gluon/cache.py, line 371, in __init__ File gluon/cache.py, line 229, in __init__ WindowsError: [Error 3] The system cannot find the path specified: 'applications\\InfoCenter\\cache' Any clues to what I should be looking at? Thanks! -Jim
Re: [web2py] vps - memory problems
Thanks Roberto. I can now see all options for uwsgi (including the one you mention for memory-report) here: http://projects.unbit.it/uwsgi/wiki/Doc Thanks again, Carlos
[web2py] Re: web2py 1.96.2 is OUT security warning
Very good security upgrade About conditional models, what are they exactly? On 3 jun, 17:23, Massimo Di Pierro massimo.dipie...@gmail.com wrote: We fixed a few more bugs (strangely most of them preexisting 1.96.1). We also addressed two security issues as I will explain later in this email: here is am reporting the 1.96.1 changelog with some additions Changelog: - from gluon import * imports in every python module a web2py environment (A, DIV,..SQLFORM, DAL, Field,...) including current.request, current.response, current.session, current.T, current.cache, thanks Jonathan. - conditional models in models/controller/a.py and models/controller/function/a.py - from mymodule import *, looks for mymodule in applications/thisapp/ modules first and then in sys.path. No more need for local_import. Thanks Pierre. - usage of generic.* views is - by default - restricted to localhost for security. This can be changed in a granular way with: response.generic_patterns=['*']. This is a slight change of behavior for new app but a major security fix. - all applications have cas 2.0 provider athttp://.../user/cas/login - all applications can delegate to login to external provider Auth(...,cas_provider='http://.../other_app/default/user/cas') - A(...,callback=URL(...),larget='id') does Ajax - URL(...,user_signature=True), LOAD(...,user_signature=True) can sign urls and @auth.requires_signature() will check the signature for any decorated action. - DAL(...,migrate_enabled=False) to disable all migrations - DAL(...,fake_migrate_all=True) to rebuild all corrupted metadata - new DAL metadata format (databases/*.table) - DAL(...,adapter_arg={}) allows support for alternate drivers - DAL now allows circular table defintions - DAL(..,auto_import=True) automatically imports tables from metadata without need to db.define_table(...)s. - new alterante syntax for inner joins: db(...).select(join=...) - experimental cubrid database support - DAL 'request_tenant' fields are special, the altomatically filer all records based on their default value. - db._common_fields.append(Field('owner')) allows to add fields to ALL tables - DAL ignores repeated fields with same names - web2py_ajax.html is more modular, thanks Anthony - request.is_local - request.is_http - new sessions2trash.py thanks Jim Karsten - corrupted cache files are automatically deleted - new simpler API gluon.contrib.AuthorizeNet.procss(...) - fixed recaptcha (as they released new API) - messages in validators have default internationalization - No more Auth(globals(),db), just Auth(db). Same for Crud and Service. - scripts/access.wsgi allows apache+mod_wsgi to delegate authentication of any URL to any web2py app - json now supports T(...) - scripts/setup-web2py-nginx-uwsgi-ubuntu.sh - web2py HTTP responses now set: X-Powered-By: web2py, thanks Bruno - mostly fixed generic.pdf. You can view any page in PDF if you have pdflatex installed or if your html follows the pyfpdf convention. - auth.settings.extra_fields['auth_user'].append(Field('country')) allows to extend auth_* tables without need of definiting a custom auth_* table. Must be placed before auth.define_tables() - {{=response.toolbar()}} to help you debug applications - web based shell now supports object modifications (but no redefinitions of non-serializable types) - jQuery 1.6.1 - more secure uuid function to protect sessions form cryptographic attacks - auto logout of appadmin - Lots of bug fixes ## Security wanring This release fixes two security issues: 1) web2py used random to generate uuid. This is mostly fine but it was technically possible for an attacker to retrieve a lot of session uuids, extrapolate information about the pseudo-random-generator and use the information to guess somebody else's session. Our new contributor and security expert David Wager, spotted this problem and suggested rewriting the web2py uuid function used for generating session names. The new function uses /dev/urandom as entropy source and falls back to the old method when the entropy source is not available, issuing a warning. 2) appadmin uses admin authentication but failed to detect expires sessions (60minutes). This has now been corrected.
[web2py] Re: LOAD: ajax_trap errors... (still in 1.96.1)
Verified fixed in 1.96.2
Re: [web2py] Re: web2py 1.96.2 is OUT security warning
Where do we set the response headers? On 6/3/11 12:17 PM, GoldenTiger wrote: Very good security upgrade About conditional models, what are they exactly? On 3 jun, 17:23, Massimo Di Pierromassimo.dipie...@gmail.com wrote: We fixed a few more bugs (strangely most of them preexisting 1.96.1). We also addressed two security issues as I will explain later in this email: here is am reporting the 1.96.1 changelog with some additions Changelog: - from gluon import * imports in every python module a web2py environment (A, DIV,..SQLFORM, DAL, Field,...) including current.request, current.response, current.session, current.T, current.cache, thanks Jonathan. - conditional models in models/controller/a.py and models/controller/function/a.py - from mymodule import *, looks for mymodule in applications/thisapp/ modules first and then in sys.path. No more need for local_import. Thanks Pierre. - usage of generic.* views is - by default - restricted to localhost for security. This can be changed in a granular way with: response.generic_patterns=['*']. This is a slight change of behavior for new app but a major security fix. - all applications have cas 2.0 provider athttp://.../user/cas/login - all applications can delegate to login to external provider Auth(...,cas_provider='http://.../other_app/default/user/cas') - A(...,callback=URL(...),larget='id') does Ajax - URL(...,user_signature=True), LOAD(...,user_signature=True) can sign urls and @auth.requires_signature() will check the signature for any decorated action. - DAL(...,migrate_enabled=False) to disable all migrations - DAL(...,fake_migrate_all=True) to rebuild all corrupted metadata - new DAL metadata format (databases/*.table) - DAL(...,adapter_arg={}) allows support for alternate drivers - DAL now allows circular table defintions - DAL(..,auto_import=True) automatically imports tables from metadata without need to db.define_table(...)s. - new alterante syntax for inner joins: db(...).select(join=...) - experimental cubrid database support - DAL 'request_tenant' fields are special, the altomatically filer all records based on their default value. - db._common_fields.append(Field('owner')) allows to add fields to ALL tables - DAL ignores repeated fields with same names - web2py_ajax.html is more modular, thanks Anthony - request.is_local - request.is_http - new sessions2trash.py thanks Jim Karsten - corrupted cache files are automatically deleted - new simpler API gluon.contrib.AuthorizeNet.procss(...) - fixed recaptcha (as they released new API) - messages in validators have default internationalization - No more Auth(globals(),db), just Auth(db). Same for Crud and Service. - scripts/access.wsgi allows apache+mod_wsgi to delegate authentication of any URL to any web2py app - json now supports T(...) - scripts/setup-web2py-nginx-uwsgi-ubuntu.sh - web2py HTTP responses now set: X-Powered-By: web2py, thanks Bruno - mostly fixed generic.pdf. You can view any page in PDF if you have pdflatex installed or if your html follows the pyfpdf convention. - auth.settings.extra_fields['auth_user'].append(Field('country')) allows to extend auth_* tables without need of definiting a custom auth_* table. Must be placed before auth.define_tables() - {{=response.toolbar()}} to help you debug applications - web based shell now supports object modifications (but no redefinitions of non-serializable types) - jQuery 1.6.1 - more secure uuid function to protect sessions form cryptographic attacks - auto logout of appadmin - Lots of bug fixes ## Security wanring This release fixes two security issues: 1) web2py used random to generate uuid. This is mostly fine but it was technically possible for an attacker to retrieve a lot of session uuids, extrapolate information about the pseudo-random-generator and use the information to guess somebody else's session. Our new contributor and security expert David Wager, spotted this problem and suggested rewriting the web2py uuid function used for generating session names. The new function uses /dev/urandom as entropy source and falls back to the old method when the entropy source is not available, issuing a warning. 2) appadmin uses admin authentication but failed to detect expires sessions (60minutes). This has now been corrected.
[web2py] Inserting records using DAL outside of web2py
Hi I'm using DAL outside of web2py with the following code: import sys sys.path.append('w:/web2py/library.zip') from gluon import DAL db = DAL('mysql://root:98lkjdfa@asdf09/ic2',folder='w:/web2py/applications/InfoCenter/databases', auto_import=True) print db.tables rows = db().select(db.auth_user.ALL) for row in rows: print row.first_name, row.last_name result = db.auth_user.insert(first_name='Stephen', last_name='Jones') print result db.commit() The definition of my auth_user table is: auth_user = db.define_table( auth.settings.table_user_name, Field('first_name', length=128, default='', required=True), Field('last_name', length=128, default='', required=True), Field('email', length=128, unique=True, required=True), Field('password', 'password', length=512, readable=False, label='Password'), Field('registration_key', length=512, writable=False, readable=False, default=''), Field('reset_password_key', length=512, writable=False, readable=False, default=''), Field('registration_id', length=512, writable=False, readable=False, default=''), Field('brillLogon', length=10, default='', label='Brill Logon'), Field('technician', 'boolean', default=False)) auth_user.first_name.requires = IS_NOT_EMPTY(error_message=auth.messages.is_empty) auth_user.last_name.requires = IS_NOT_EMPTY(error_message=auth.messages.is_empty) auth_user.password.requires = [IS_STRONG(), CRYPT()] auth_user.email.requires = [IS_EMAIL(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db, auth_user.email), IS_NOT_EMPTY(error_message=auth.messages.is_empty)] auth.settings.table_user = auth_user I'm confused because it is allowing me to insert a row without and email even though I'm telling it that email should not be empty and that it is required. What am I missing? -Jim
[web2py] Authorize.net CIM XML - any experts?
I'm attempting to test out the CIM XML method of working with authorize.net, and I'm not entirely sure how to even display the response I'm getting. I've tried a few tricks I know, but everything is breaking. I know at this point it's gotta' be a simple thing, but my unfamiliarity with python (still trying to get up to speed) is rearing its ugly head. How would I display that authResponse object just to see what kind of errors/values I'm getting? I've tried authResponse.read and using TAG, but it's coming back in some format I don't know how to deal with. Of, even better, if anybody has used CIM XML, can they point me in another direction that works? =) Thanks, guys. code import urllib2 payload = '''?xml version=1.0 encoding=utf-8? createCustomerProfileRequest xmlns= AnetApi/xml/v1/schema/AnetApiSchema.xsd merchantAuthentication name/name transactionKey/transactionKey /merchantAuthentication /createCustomerProfileRequest''' url = 'https://apitest.authorize.net/xml/v1/request.api' opener = urllib2.build_opener() opener.addheaders = [('Content-Type', 'text/xml'),] req = urllib2.Request(url=url, data=payload) assert req.get_method() == 'POST' authResponse = opener.open(req)
Re: [web2py] Re: web2py 1.96.2 is OUT security warning
On Fri, Jun 3, 2011 at 1:17 PM, GoldenTiger goldenboy...@ wrote: Very good security upgrade About conditional models, what are they exactly? user requests http://127.0.0.1:8000/app and all python files under app/models folder will be executed, this is not always necessary, because not all your controllers will need to use objects defined in all models, so you end up with more objects in memory than you really need. *Now with conditional models:* request http://127.0.0.1:8000/app/default/anything - all models under app/models folders will be executed. also all files under app/models/default request http://127.0.0.1:8000/app/anothercontroller/anything - all models under app/models folders will be executed. also all files under app/models/anothercontroller request http://127.0.0.1:8000/app/default/home.html - all models under app/models + all models under app/models/default + all models under app/models/default/home Practically your simple contact page no need to load all models to simply shows a contact form. requesting: http://127.0.0.1:8000/app/default/contact will execute all models under app/models (try to let just global access objects defined there), also all models under app/models/default (only default.py controller commom objects) and also all models in app/default/contact (specific objects for contact page, i.e: define the contact_table, load lists to populate dropboxes, maps etc..) I hope it explains how it works. Bruno Rocha http://blouweb.com http://CursoDePython.com.br
[web2py] Re: Inserting records using DAL outside of web2py
Setting requires only performs validation with CRUD and SQLFORM. Doing a direct insert does not cause validation to be checked. Try using validate_and_insert() instead of insert().
Re: [web2py] Error With Plugin Wiki
Martin: Thanks for the pointer. I installed the latest version and it works now.. Take care.. On Fri, Jun 3, 2011 at 3:12 AM, Martín Mulone mulone.mar...@gmail.comwrote: You have the last web2py installed? 2011/6/3 joseph simpson jjs0...@gmail.com I am just starting to use the plugin wiki. Simple text pages appear to work, but the jqgrid component gives the error documented in the attached screen shot. Any ideas on what I am doing wrong? Thanks for your help, Joe -- Joe Simpson Sent From My DROID!! -- http://martin.tecnodoc.com.ar -- Joe Simpson Sent From My DROID!!
RE: [web2py] Re: Inserting records using DAL outside of web2py
Perfect, thanks! From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of Ross Peoples Sent: Friday, June 03, 2011 12:11 PM To: web2py@googlegroups.com Subject: [web2py] Re: Inserting records using DAL outside of web2py Setting requires only performs validation with CRUD and SQLFORM. Doing a direct insert does not cause validation to be checked. Try using validate_and_insert() instead of insert().
[web2py] Updates and Queries strange behavior
Hi everyone I have a strange issue with web2py and a mysql db. So far I always developed locally in my computer and only uploaded code once development was done, and only small modifications were made then. But right now I have an app that I'm working on a web server. I have been able to add views and controller with no problem. But yesterday I need to add a new field to two tables of the db. So I modified the db.py to add this fields. The applications is still working. I have forms to fill this new fields, and they appear to work, but once you try to read them they return None. I then connected through phpmyadmin and observed that the new columns of the db are there, but that the information is not. The thing is that web2py raises no exception or error. Can you please help me figure out what could possibly be wrong? By the way all coding has been done through ssh with a command line editor, so I was wondering if maybe the web browser interfaces updates some other configuration files when the db is modified. Could this be the problem? Thank you.
[web2py] Re : Re: Social network plug-in
I have asked some of these questions on Stackoverflow, because it also concerns Python. I have received interesting answers : http://stackoverflow.com/questions/6230117/python-reduce-function-and-operator François
[web2py] clarification about upgrading web2py on ajax applications
Hi All, when I upgrade web2py I unzip the file and just run it... then I copy manually static files (to get any new JS or CSS neded by web2py_ajax.html) and web2py_ajax.htmlhttp://www.web2py.com/demo_admin/default/peek/demo_app2/views/web2py_ajax.htmlfrom the welcome application into my applications. Am I missing something ? thanks -- Sebastian E. Ovide
[web2py] Re: web2py 1.96.2 is OUT security warning
anywhere you like: response.headers['Content-Type']='test/html' On Jun 3, 11:35 am, David J. da...@styleflare.com wrote: Where do we set the response headers? On 6/3/11 12:17 PM, GoldenTiger wrote: Very good security upgrade About conditional models, what are they exactly? On 3 jun, 17:23, Massimo Di Pierromassimo.dipie...@gmail.com wrote: We fixed a few more bugs (strangely most of them preexisting 1.96.1). We also addressed two security issues as I will explain later in this email: here is am reporting the 1.96.1 changelog with some additions Changelog: - from gluon import * imports in every python module a web2py environment (A, DIV,..SQLFORM, DAL, Field,...) including current.request, current.response, current.session, current.T, current.cache, thanks Jonathan. - conditional models in models/controller/a.py and models/controller/function/a.py - from mymodule import *, looks for mymodule in applications/thisapp/ modules first and then in sys.path. No more need for local_import. Thanks Pierre. - usage of generic.* views is - by default - restricted to localhost for security. This can be changed in a granular way with: response.generic_patterns=['*']. This is a slight change of behavior for new app but a major security fix. - all applications have cas 2.0 provider athttp://.../user/cas/login - all applications can delegate to login to external provider Auth(...,cas_provider='http://.../other_app/default/user/cas') - A(...,callback=URL(...),larget='id') does Ajax - URL(...,user_signature=True), LOAD(...,user_signature=True) can sign urls and @auth.requires_signature() will check the signature for any decorated action. - DAL(...,migrate_enabled=False) to disable all migrations - DAL(...,fake_migrate_all=True) to rebuild all corrupted metadata - new DAL metadata format (databases/*.table) - DAL(...,adapter_arg={}) allows support for alternate drivers - DAL now allows circular table defintions - DAL(..,auto_import=True) automatically imports tables from metadata without need to db.define_table(...)s. - new alterante syntax for inner joins: db(...).select(join=...) - experimental cubrid database support - DAL 'request_tenant' fields are special, the altomatically filer all records based on their default value. - db._common_fields.append(Field('owner')) allows to add fields to ALL tables - DAL ignores repeated fields with same names - web2py_ajax.html is more modular, thanks Anthony - request.is_local - request.is_http - new sessions2trash.py thanks Jim Karsten - corrupted cache files are automatically deleted - new simpler API gluon.contrib.AuthorizeNet.procss(...) - fixed recaptcha (as they released new API) - messages in validators have default internationalization - No more Auth(globals(),db), just Auth(db). Same for Crud and Service. - scripts/access.wsgi allows apache+mod_wsgi to delegate authentication of any URL to any web2py app - json now supports T(...) - scripts/setup-web2py-nginx-uwsgi-ubuntu.sh - web2py HTTP responses now set: X-Powered-By: web2py, thanks Bruno - mostly fixed generic.pdf. You can view any page in PDF if you have pdflatex installed or if your html follows the pyfpdf convention. - auth.settings.extra_fields['auth_user'].append(Field('country')) allows to extend auth_* tables without need of definiting a custom auth_* table. Must be placed before auth.define_tables() - {{=response.toolbar()}} to help you debug applications - web based shell now supports object modifications (but no redefinitions of non-serializable types) - jQuery 1.6.1 - more secure uuid function to protect sessions form cryptographic attacks - auto logout of appadmin - Lots of bug fixes ## Security wanring This release fixes two security issues: 1) web2py used random to generate uuid. This is mostly fine but it was technically possible for an attacker to retrieve a lot of session uuids, extrapolate information about the pseudo-random-generator and use the information to guess somebody else's session. Our new contributor and security expert David Wager, spotted this problem and suggested rewriting the web2py uuid function used for generating session names. The new function uses /dev/urandom as entropy source and falls back to the old method when the entropy source is not available, issuing a warning. 2) appadmin uses admin authentication but failed to detect expires sessions (60minutes). This has now been corrected.
[web2py] Re: Authorize.net CIM XML - any experts?
from gluon.contrib.AuthorizeNet import process look into gluon/contrib/AuthorizeNet.py for examples On Jun 3, 12:03 pm, vapirix vapi...@gmail.com wrote: I'm attempting to test out the CIM XML method of working with authorize.net, and I'm not entirely sure how to even display the response I'm getting. I've tried a few tricks I know, but everything is breaking. I know at this point it's gotta' be a simple thing, but my unfamiliarity with python (still trying to get up to speed) is rearing its ugly head. How would I display that authResponse object just to see what kind of errors/values I'm getting? I've tried authResponse.read and using TAG, but it's coming back in some format I don't know how to deal with. Of, even better, if anybody has used CIM XML, can they point me in another direction that works? =) Thanks, guys. code import urllib2 payload = '''?xml version=1.0 encoding=utf-8? createCustomerProfileRequest xmlns= AnetApi/xml/v1/schema/AnetApiSchema.xsd merchantAuthentication name/name transactionKey/transactionKey /merchantAuthentication /createCustomerProfileRequest''' url = 'https://apitest.authorize.net/xml/v1/request.api' opener = urllib2.build_opener() opener.addheaders = [('Content-Type', 'text/xml'),] req = urllib2.Request(url=url, data=payload) assert req.get_method() == 'POST' authResponse = opener.open(req)
[web2py] Re: Inserting records using DAL outside of web2py
Mind that DAL(...,auto_import=True) does NOT import validators. On Jun 3, 12:13 pm, j...@qlf.com j...@qlf.com wrote: Perfect, thanks! From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of Ross Peoples Sent: Friday, June 03, 2011 12:11 PM To: web2py@googlegroups.com Subject: [web2py] Re: Inserting records using DAL outside of web2py Setting requires only performs validation with CRUD and SQLFORM. Doing a direct insert does not cause validation to be checked. Try using validate_and_insert() instead of insert().
[web2py] Re: Updates and Queries strange behavior
db.commit()? On Jun 3, 12:19 pm, Francisco betancourt.franci...@gmail.com wrote: Hi everyone I have a strange issue with web2py and a mysql db. So far I always developed locally in my computer and only uploaded code once development was done, and only small modifications were made then. But right now I have an app that I'm working on a web server. I have been able to add views and controller with no problem. But yesterday I need to add a new field to two tables of the db. So I modified the db.py to add this fields. The applications is still working. I have forms to fill this new fields, and they appear to work, but once you try to read them they return None. I then connected through phpmyadmin and observed that the new columns of the db are there, but that the information is not. The thing is that web2py raises no exception or error. Can you please help me figure out what could possibly be wrong? By the way all coding has been done through ssh with a command line editor, so I was wondering if maybe the web browser interfaces updates some other configuration files when the db is modified. Could this be the problem? Thank you.
[web2py] Re: clarification about upgrading web2py on ajax applications
Yes. The new wb2py_ajax.html imports static/js/web2py_ajax.js Massimo On Jun 3, 12:33 pm, Sebastian E. Ovide sebastian.ov...@gmail.com wrote: Hi All, when I upgrade web2py I unzip the file and just run it... then I copy manually static files (to get any new JS or CSS neded by web2py_ajax.html) and web2py_ajax.htmlhttp://www.web2py.com/demo_admin/default/peek/demo_app2/views/web2py_...from the welcome application into my applications. Am I missing something ? thanks -- Sebastian E. Ovide
Re: [web2py] BUG?: Funny Bug with LOAD;
it works for me (1.96.2)... I can see the login page in the whole page On Fri, Jun 3, 2011 at 4:09 PM, David J. da...@styleflare.com wrote: Maybe its not a bug; But I found a strange behavior; I am using LOAD to load some views; I also use @auth.requires_login() I just saw that If I try to reload the component after the session expires the component loads the login page where the component should go; Perhaps once the session expires; we should force the whole page to be redirected? Any thoughts? Thanks. -- Sebastian E. Ovide
Re: [web2py] BUG?: Funny Bug with LOAD;
Let me see are you using ajax=True or False? Because I am using ajax; and login page loaded in the content panel. I will update my trunk now and test agian. On 6/3/11 2:29 PM, Sebastian E. Ovide wrote: it works for me (1.96.2)... I can see the login page in the whole page On Fri, Jun 3, 2011 at 4:09 PM, David J. da...@styleflare.com mailto:da...@styleflare.com wrote: Maybe its not a bug; But I found a strange behavior; I am using LOAD to load some views; I also use @auth.requires_login() I just saw that If I try to reload the component after the session expires the component loads the login page where the component should go; Perhaps once the session expires; we should force the whole page to be redirected? Any thoughts? Thanks. -- Sebastian E. Ovide
[web2py] Re: BUG?: Funny Bug with LOAD;
I did not change aout thing between 1.96.1 and 1.96.2 but I cannot yet confirm the problem. On Jun 3, 1:35 pm, David J. da...@styleflare.com wrote: Let me see are you using ajax=True or False? Because I am using ajax; and login page loaded in the content panel. I will update my trunk now and test agian. On 6/3/11 2:29 PM, Sebastian E. Ovide wrote: it works for me (1.96.2)... I can see the login page in the whole page On Fri, Jun 3, 2011 at 4:09 PM, David J. da...@styleflare.com mailto:da...@styleflare.com wrote: Maybe its not a bug; But I found a strange behavior; I am using LOAD to load some views; I also use @auth.requires_login() I just saw that If I try to reload the component after the session expires the component loads the login page where the component should go; Perhaps once the session expires; we should force the whole page to be redirected? Any thoughts? Thanks. -- Sebastian E. Ovide
[web2py] Trapped Ajax Links (bug?)
Hi All, in the view {{=LOAD(f=seba.load,ajax=True)}} in the controller def seba(): import random return dict(txt=random.random()) in seba.load {{=A http://127.0.0.1:8000/examples/global/vars/A('click me', _href=URL http://127.0.0.1:8000/examples/global/vars/URL('seba.load'),cid=request http://127.0.0.1:8000/examples/global/vars/request.cid)}} It works great with ajax=True, but it does'n work with {{=LOAD(f=seba.load,ajax_trap=True)}} when I click on the link it load the seba.load on the whole screen... any ideas ? -- Sebastian E. Ovide
Re: [web2py] Re: Inserting records using DAL outside of web2py
Without respecifying the validators is there a way to get them imported? This seems to be a fairly significant hole. Is there something I'm missing? -Jim On 6/3/2011 1:26 PM, Massimo Di Pierro wrote: Mind that DAL(...,auto_import=True) does NOT import validators. On Jun 3, 12:13 pm, j...@qlf.comj...@qlf.com wrote: Perfect, thanks! From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of Ross Peoples Sent: Friday, June 03, 2011 12:11 PM To: web2py@googlegroups.com Subject: [web2py] Re: Inserting records using DAL outside of web2py Setting requires only performs validation with CRUD and SQLFORM. Doing a direct insert does not cause validation to be checked. Try using validate_and_insert() instead of insert(). -- Jim Steil VP of Information Technology Quality Liquid Feeds, Inc. 608.935.2345 office 608.341.9896 cell
Re: [web2py] BUG?: Funny Bug with LOAD;
you are right, with ajax=True it doesn't work On Fri, Jun 3, 2011 at 7:35 PM, David J. da...@styleflare.com wrote: Let me see are you using ajax=True or False? Because I am using ajax; and login page loaded in the content panel. I will update my trunk now and test agian. On 6/3/11 2:29 PM, Sebastian E. Ovide wrote: it works for me (1.96.2)... I can see the login page in the whole page On Fri, Jun 3, 2011 at 4:09 PM, David J. da...@styleflare.com wrote: Maybe its not a bug; But I found a strange behavior; I am using LOAD to load some views; I also use @auth.requires_login() I just saw that If I try to reload the component after the session expires the component loads the login page where the component should go; Perhaps once the session expires; we should force the whole page to be redirected? Any thoughts? Thanks. -- Sebastian E. Ovide -- Sebastian E. Ovide
Re: [web2py] vps - memory problems
Hi, My models are relatively big in file size ( 200 kb in total). Is ALL this code being loaded into memory for each web request over and over again, and without reusing the same files (that do not change)?. I'm noticing a consistent increase in memory % in each of the uwsgi-python processes/workers for simple web requests. This makes me think that web2py (or uwsgi-python) is loading the code for all models into memory for each web request without any caching / reusing, and without releasing any memory from previous requests, but only consuming more and more memory each time. This means that I run out of memory after a very few requests ! Am I not correct above?, am I doing something wrong?, is this actually expected?, does this occur regardless of the web server or wsgi interface?. On a related note, should I move everything to modules (instead of models)?, will this fix the memory issues?. How can I solve this show-stopper problem?. I'm on a vps (vps.net) with ubuntu 10.4 lts lucid, nginx, uwsgi-python, postgresql, latest web2py. Thanks, Carlos
[web2py] Re: Authorize.net CIM XML - any experts?
I'm using CIM, not AIM, though. On Jun 3, 1:25 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: from gluon.contrib.AuthorizeNet import process look into gluon/contrib/AuthorizeNet.py for examples On Jun 3, 12:03 pm, vapirix vapi...@gmail.com wrote: I'm attempting to test out the CIM XML method of working with authorize.net, and I'm not entirely sure how to even display the response I'm getting. I've tried a few tricks I know, but everything is breaking. I know at this point it's gotta' be a simple thing, but my unfamiliarity with python (still trying to get up to speed) is rearing its ugly head. How would I display that authResponse object just to see what kind of errors/values I'm getting? I've tried authResponse.read and using TAG, but it's coming back in some format I don't know how to deal with. Of, even better, if anybody has used CIM XML, can they point me in another direction that works? =) Thanks, guys. code import urllib2 payload = '''?xml version=1.0 encoding=utf-8? createCustomerProfileRequest xmlns= AnetApi/xml/v1/schema/AnetApiSchema.xsd merchantAuthentication name/name transactionKey/transactionKey /merchantAuthentication /createCustomerProfileRequest''' url = 'https://apitest.authorize.net/xml/v1/request.api' opener = urllib2.build_opener() opener.addheaders = [('Content-Type', 'text/xml'),] req = urllib2.Request(url=url, data=payload) assert req.get_method() == 'POST' authResponse = opener.open(req)
Re: [web2py] vps - memory problems
On Fri, Jun 3, 2011 at 4:03 PM, Carlos carlosgali...@gmail.com wrote: My models are relatively big in file size ( 200 kb in total). Is ALL this code being loaded into memory for each web request over and over again, and without reusing the same files (that do not change)? Now you can use conditional models in subfolders - https://groups.google.com/forum/#!msg/web2py/IWg3nU663Gc/DcbSTlhK2zUJ
Re: [web2py] vps - memory problems
Hi, My models are relatively big in file size ( 200 kb in total). Is ALL this code being loaded into memory for each web request over and over again, and without reusing the same files (that do not change)?. I'm noticing a consistent increase in memory % in each of the uwsgi-python processes/workers for simple web requests. This makes me think that web2py (or uwsgi-python) is loading the code for all models into memory for each web request without any caching / reusing, and without releasing any memory from previous requests, but only consuming more and more memory each time. This means that I run out of memory after a very few requests ! Am I not correct above?, am I doing something wrong?, is this actually expected?, does this occur regardless of the web server or wsgi interface?. On a related note, should I move everything to modules (instead of models)?, will this fix the memory issues?. How can I solve this show-stopper problem?. Honestly, (without knowing your app) i do no think this is a problem related to web2py (and for sure it is not a uWSGI as its policy is: NO LEAK). Probably something in your app is leaking memory, but in the mean time you can patch the problem with something like --reload-on-rss n where n is the number of megs after which a worker is restarted (freeing its memory). I think 200 (megs) should be enough to maintain your webserver healthy. -- Roberto De Ioris http://unbit.it
Re: [web2py] components in related tables
thank you so much for your hint, pbreit, i'd already put an id on the controller. e.g. page = table_0(request.args(0)) or redirect(URL(index_link)) any idea, hints or suggestion to solve this problem? thank you so much in advance. On Fri, Jun 3, 2011 at 9:12 PM, pbreit pbreitenb...@gmail.com wrote: You need to pass an I'd to show controller so it knows what comments to pull.
Re: [web2py] Re: GAE taskqueue with Web2py 1.95.1
i'm curious about what that bug in db.py was that broke the dev_appserver. if we ever get to the point where development and production environments are exactly the same, think about how many QA jobs would be lost! ;) cfh
[web2py] Re: Updates and Queries strange behavior
I don't think it's that (anyway I tried and no). The thing is, for example in one part I use an insert and all values are inserted except for the value corresponding to the column I recently added. Any other ideas??? On 3 jun, 13:26, Massimo Di Pierro massimo.dipie...@gmail.com wrote: db.commit()? On Jun 3, 12:19 pm, Francisco betancourt.franci...@gmail.com wrote:
[web2py] Re: Authorize.net CIM XML - any experts?
skip the XML, use SOAP. that's my solution: profile_id = 42 merchantAuthentication={'name':api_login_id, 'transactionKey':transaction_key} from pysimplesoap.client import SoapClient #@TODO: can i cache the SoapClient object? client = SoapClient(wsdl=https://apitest.authorize.net/soap/v1/Service.asmx?WSDL;, exceptions=False) cust_profile = client.GetCustomerProfile( \ merchantAuthentication=merchantAuthentication, customerProfileId=profile_id) return cust_profile and now your response is a dict and you can just use it. i'm in the middle of an authorize.net CIM and AIM implementation, so lemme know if you have more questions, we can figure this out! cfh
[web2py] Re: clarification about upgrading web2py on ajax applications
I think there were also some recent changes in some of the generic view files, if you happen to be using any of them. Anthony On Friday, June 3, 2011 10:33:01 AM UTC-7, sebastian wrote: Hi All, when I upgrade web2py I unzip the file and just run it... then I copy manually static files (to get any new JS or CSS neded by web2py_ajax.html) and web2py_ajax.htmlhttp://www.web2py.com/demo_admin/default/peek/demo_app2/views/web2py_ajax.htmlfrom the welcome application into my applications. Am I missing something ? thanks -- Sebastian E. Ovide
Re: [web2py] Re: GAE taskqueue with Web2py 1.95.1
it was this definition: auth.messages.verify_email = request.env.http_host+str(URL(r=request,c='default',f='user', args=['verify_email']))+'/%(key)s to verify your email' which I had changed from: auth.messages.verify_email = request.env.http_host+URL(r=request,c='default',f='user', args=['verify_email'])+'/%(key)s to verify your email' when URL's return type was redefined by Web2py. Running locally on web2py's server and the system blustered on through this as did dev_appserver most of the time. But when dev_appserver called by task, it stopped at this line and returned 500. # set the QAs free I say! On 3 June 2011 22:17, howesc how...@umich.edu wrote: i'm curious about what that bug in db.py was that broke the dev_appserver. if we ever get to the point where development and production environments are exactly the same, think about how many QA jobs would be lost! ;) cfh
Re: [web2py] components in related tables
I'm not sure exactly how your code works but I'd didn't seen an arg in this load: {{=LOAD('default', 'blog_comment_show.load', ajax = True)}}
Re: [web2py] components in related tables
o, i c, thanks so much for showing my code fault, pbreit, i'll try to fix and test it. On Sat, Jun 4, 2011 at 5:02 AM, pbreit pbreitenb...@gmail.com wrote: I'm not sure exactly how your code works but I'd didn't seen an arg in this load: {{=LOAD('default', 'blog_comment_show.load', ajax = True)}}
[web2py] Re: web2py 1.96.1 is OUT
I have tried the new modules import feature (from mymodule import *, looks for mymodule in applications/thisapp/ modules first and then in sys.path. No more need for local_import) and it works wonderfully on OS/X but not at all on Windows. Below you can find the traceback. web2py™Version 1.96.2 (2011-06-03 16:11:39)PythonPython 2.5.4: C:\web2py\web2py.exe Traceback (most recent call last): File gluon/restricted.py, line 184, in restricted File C:/web2py/applications/castalia/controllers/default.py http://127.0.0.1:8000/admin/default/edit/castalia/controllers/default.py, line 2, in module File gluon/custom_import.py, line 280, in __call__ File gluon/custom_import.py, line 125, in __call__ ImportError: No module named selfgroup.castalia Any suggestion? Thank you
[web2py] Re: web2py 1.96.2 is OUT security warning
I have tried the new import behavior (placing modules inside the application's modules folder) and it works correctly under OS/X but not at all under Windows (XP). Below you can find the Windows traceback. web2py™ Version 1.96.2 (2011-06-03 16:11:39) Python Python 2.5.4: C:\web2py\web2py.exe Traceback (most recent call last): File gluon/restricted.py, line 184, in restricted File C:/web2py/applications/castalia/controllers/default.py, line 2, in module File gluon/custom_import.py, line 280, in __call__ File gluon/custom_import.py, line 125, in __call__ ImportError: No module named selfgroup.castalia Any suggestion? - from mymodule import *, looks for mymodule in applications/thisapp/ modules first and then in sys.path. No more need for local_import. Thanks Pierre.
Re: [web2py] vps - memory problems
On 3 June 2011 21:57, Roberto De Ioris robe...@unbit.it wrote: Hi, My models are relatively big in file size ( 200 kb in total). Is ALL this code being loaded into memory for each web request over and over again, and without reusing the same files (that do not change)?. I'm noticing a consistent increase in memory % in each of the uwsgi-python processes/workers for simple web requests. This makes me think that web2py (or uwsgi-python) is loading the code for all models into memory for each web request without any caching / reusing, and without releasing any memory from previous requests, but only consuming more and more memory each time. This means that I run out of memory after a very few requests ! Am I not correct above?, am I doing something wrong?, is this actually expected?, does this occur regardless of the web server or wsgi interface?. On a related note, should I move everything to modules (instead of models)?, will this fix the memory issues?. How can I solve this show-stopper problem?. Honestly, (without knowing your app) i do no think this is a problem related to web2py (and for sure it is not a uWSGI as its policy is: NO LEAK). Probably something in your app is leaking memory, but in the mean time you can patch the problem with something like --reload-on-rss n where n is the number of megs after which a worker is restarted (freeing its memory). I think 200 (megs) should be enough to maintain your webserver healthy. -- Roberto De Ioris http://unbit.it Hey, take a look about this bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=480541 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=480541Check to be sure that you are getting real info with $ top hope is useful for you. Jhonny5. -- Po fueno, po fale, po malegro. talueee.com .,p=b_ ?P._ `*b |P .d?' ,9| M: |}|- H' | `#?_._oH' `H. ``' `#?. `^~. Anyone can make something complicated, but it takes genius to make something simple. Linux User #236965 (counter.li.org)
[web2py] Re: BUG?: Funny Bug with LOAD;
please open an issue on google code On Jun 3, 1:53 pm, Sebastian E. Ovide sebastian.ov...@gmail.com wrote: you are right, with ajax=True it doesn't work On Fri, Jun 3, 2011 at 7:35 PM, David J. da...@styleflare.com wrote: Let me see are you using ajax=True or False? Because I am using ajax; and login page loaded in the content panel. I will update my trunk now and test agian. On 6/3/11 2:29 PM, Sebastian E. Ovide wrote: it works for me (1.96.2)... I can see the login page in the whole page On Fri, Jun 3, 2011 at 4:09 PM, David J. da...@styleflare.com wrote: Maybe its not a bug; But I found a strange behavior; I am using LOAD to load some views; I also use @auth.requires_login() I just saw that If I try to reload the component after the session expires the component loads the login page where the component should go; Perhaps once the session expires; we should force the whole page to be redirected? Any thoughts? Thanks. -- Sebastian E. Ovide -- Sebastian E. Ovide
[web2py] Re: web2py 1.96.1 is OUT
please open a ticken on google code On Jun 3, 2:40 pm, Alessandro Iob alessandro@gmail.com wrote: I have tried the new modules import feature (from mymodule import *, looks for mymodule in applications/thisapp/ modules first and then in sys.path. No more need for local_import) and it works wonderfully on OS/X but not at all on Windows. Below you can find the traceback. web2py™Version 1.96.2 (2011-06-03 16:11:39)PythonPython 2.5.4: C:\web2py\web2py.exe Traceback (most recent call last): File gluon/restricted.py, line 184, in restricted File C:/web2py/applications/castalia/controllers/default.py http://127.0.0.1:8000/admin/default/edit/castalia/controllers/default.py, line 2, in module File gluon/custom_import.py, line 280, in __call__ File gluon/custom_import.py, line 125, in __call__ ImportError: No module named selfgroup.castalia Any suggestion? Thank you
Re: [web2py] Re: BUG?: Funny Bug with LOAD;
tracked in http://code.google.com/p/web2py/issues/detail?id=285 On Sat, Jun 4, 2011 at 12:53 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: please open an issue on google code On Jun 3, 1:53 pm, Sebastian E. Ovide sebastian.ov...@gmail.com wrote: you are right, with ajax=True it doesn't work On Fri, Jun 3, 2011 at 7:35 PM, David J. da...@styleflare.com wrote: Let me see are you using ajax=True or False? Because I am using ajax; and login page loaded in the content panel. I will update my trunk now and test agian. On 6/3/11 2:29 PM, Sebastian E. Ovide wrote: it works for me (1.96.2)... I can see the login page in the whole page On Fri, Jun 3, 2011 at 4:09 PM, David J. da...@styleflare.com wrote: Maybe its not a bug; But I found a strange behavior; I am using LOAD to load some views; I also use @auth.requires_login() I just saw that If I try to reload the component after the session expires the component loads the login page where the component should go; Perhaps once the session expires; we should force the whole page to be redirected? Any thoughts? Thanks. -- Sebastian E. Ovide -- Sebastian E. Ovide -- Sebastian E. Ovide
[web2py] Re: Trapped Ajax Links (bug?)
tracked in http://code.google.com/p/web2py/issues/detail?id=286 On Fri, Jun 3, 2011 at 7:50 PM, Sebastian E. Ovide sebastian.ov...@gmail.com wrote: Hi All, in the view {{=LOAD(f=seba.load,ajax=True)}} in the controller def seba(): import random return dict(txt=random.random()) in seba.load {{=A http://127.0.0.1:8000/examples/global/vars/A('click me', _href=URL http://127.0.0.1:8000/examples/global/vars/URL('seba.load'),cid=request http://127.0.0.1:8000/examples/global/vars/request.cid)}} It works great with ajax=True, but it does'n work with {{=LOAD(f=seba.load,ajax_trap=True)}} when I click on the link it load the seba.load on the whole screen... any ideas ? -- Sebastian E. Ovide -- Sebastian E. Ovide
[web2py] ajax run unexpected in show page
hi, i have an ajax run unexpected in show page but not in index page, when i click the ajax in show page it will return an index page, not to update the value when i click like it work in index page. actually the ajax code is same for index and show page. === show.html === form input type=hidden id=id name=id value= / /form {{=H1(page.title)}} {{=DIV(page.content)}} {{=DIV(db.blog_category[page.category_id].category)}} {{=SPAN(page.like, _id = 'blog_like_%s' % page.id)}} {{=SPAN(T('People Like This'))}} span onclick=jQuery('#id').val('{{=page.id}}'); ajax('blog_like', ['id'], 'blog_like_{{=page.id}}'); {{=A(T('Like'), _href = '#')}} /span i know it seems like i missed something in my code, did anyone know which part i missed and how to solve it? any hints, corrections is greatly appreciate, thank you so much in advance.
Re: [web2py] splitting the field values of a list:string field
This thread could be of some help for you : http://groups.google.com/group/web2py/browse_thread/thread/50af0d67554c94d9/dfc30ce6fb4455eb?pli=1 I still not work again on this aspect, hopt to do it in the future... Richard On Fri, Jun 3, 2011 at 10:44 AM, max dulip.withan...@gmail.com wrote: I have the following use case. -- User has to input a unknown number of strings in a pref-defined format. eg. a#b#c , a1#b1#c1, a2#b1#c2 Currently i am using the list:string and allow the user to directly add the string with a hash sign. But I would prefer to format the input like this, myfield: name [a1] name2 [b1] name3 [c1] where the [] are input fields of a form horizontally. and the + sign of the web2py list adds more from the same format. For me it is ok. that everything in the myfield is saved in the |a|b| c| format. thanks for any ideas.
Re: [web2py] vps - memory problems
Hi guys, Many thanks for all your suggestions. Can you please confirm / correct the following? ... Does web2py load the code from all models into memory for each and every web request?, or does it cache/reuse the same code (as long as it does not change)?. I know web2py executes all models for every web request, but does it actually *load* the code into memory as well for every single web request?. Furthermore, if I move code from models to modules, will web2py still *reload* all code into memory for every web request, or will this be avoided?. I just confirmed that by defining a very long class (without even instantiating it) in the default Welcome model, I can see the memory being consumed by the uwsgi processes while loading /welcome/default/index ... this does not mean any leaking on the app, right?, then what can I check in order to avoid all this memory leaking?. Thanks again, Carlos
Re: [web2py] vps - memory problems
On Fri, Jun 3, 2011 at 10:39 PM, Carlos carlosgali...@gmail.com wrote: Hi guys, Many thanks for all your suggestions. Can you please confirm / correct the following? ... Does web2py load the code from all models into memory for each and every web request?, or does it cache/reuse the same code (as long as it does not change)?. if your model file resides in /models everyone in there will be loaded for each request, so you can put some model in subfolders related to controllers and functions and that models will only be loaded for the related functions. I know web2py executes all models for every web request, but does it actually *load* the code into memory as well for every single web request?. Yes, every request is a separate process, every definitions will be loades in to memory (take a look at the subfolders improvement on latest version) Furthermore, if I move code from models to modules, will web2py still *reload* all code into memory for every web request, or will this be avoided?. Every module that you import on to yor application flow will be reloaded on every request, because in every request web2py destroy recreate the environment (many frameworks does that) But, you can choose if you want to put some objects in cache using web2py cache functionality, or maybe using an external cache system as memcached. I just confirmed that by defining a very long class (without even instantiating it) in the default Welcome model, I can see the memory being consumed by the uwsgi processes while loading /welcome/default/index ... this does not mean any leaking on the app, right?, then what can I check in order to avoid all this memory leaking?. avoid the use of models to define classes, put in models only constants for configuration, create your system logic under /modules then import it when you really need. Or go with models subfolders. Thanks again, Carlos
[web2py] Re: ajax run unexpected in show page
ajax('blog_like',... should be ajax('{{=URL('blog_like.load')}}',.. hi, i have an ajax run unexpected in show page but not in index page, when i click the ajax in show page it will return an index page, not to update the value when i click like it work in index page. actually the ajax code is same for index and show page. === show.html === form input type=hidden id=id name=id value= / /form {{=H1(page.title)}} {{=DIV(page.content)}} {{=DIV(db.blog_category[page.category_id].category)}} {{=SPAN(page.like, _id = 'blog_like_%s' % page.id)}} {{=SPAN(T('People Like This'))}} span onclick=jQuery('#id').val('{{=page.id}}'); ajax('blog_like', ['id'], 'blog_like_{{=page.id}}'); {{=A(T('Like'), _href = '#')}} /span i know it seems like i missed something in my code, did anyone know which part i missed and how to solve it? any hints, corrections is greatly appreciate, thank you so much in advance.
Re: [web2py] vps - memory problems
I thnk we need more guidance on how to optimize performance and memory consumption.
Re: [web2py] vps - memory problems
On Fri, Jun 3, 2011 at 11:50 PM, pbreit pbreitenb...@gmail.com wrote: I thnk we need more guidance on how to optimize performance and memory consumption. *what I am doing:* - In models only table definitions and configuration. Avoid the use of models for classes, functions and other objects. - Use of submodels when your design allows you to separate table definitions - More use of modules, specially for user defined classes, functions and large objects - Use of an external cache system (memcached) - Disable session in places where it is not needed (and there's no need to auth) session.forget() - Avoid to load too much values in dropdown widgets and lists/grids (do pagination, load scrolling and autocompletation) - Serve static files outside web2py - Do not stay with sqlite in production
Re: [web2py] vps - memory problems
Thanks for all the recommendations. But it still worries me that web2py (or uwsgi) does not automatically (a) cache/reuse unmodified code and (b) release memory after requests are served (or while idle), after each web request, and regardless of how small or big models actually are. Carlos
Re: [web2py] Re: ajax run unexpected in show page
thank you so much for your hint and correction, massimo, it works, now. web2py is so cool On Sat, Jun 4, 2011 at 9:28 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: ajax('blog_like',... should be ajax('{{=URL('blog_like.load')}}',.. hi, i have an ajax run unexpected in show page but not in index page, when i click the ajax in show page it will return an index page, not to update the value when i click like it work in index page. actually the ajax code is same for index and show page. === show.html === form input type=hidden id=id name=id value= / /form {{=H1(page.title)}} {{=DIV(page.content)}} {{=DIV(db.blog_category[page.category_id].category)}} {{=SPAN(page.like, _id = 'blog_like_%s' % page.id)}} {{=SPAN(T('People Like This'))}} span onclick=jQuery('#id').val('{{=page.id}}'); ajax('blog_like', ['id'], 'blog_like_{{=page.id}}'); {{=A(T('Like'), _href = '#')}} /span i know it seems like i missed something in my code, did anyone know which part i missed and how to solve it? any hints, corrections is greatly appreciate, thank you so much in advance.
[web2py] Re: Authorize.net CIM XML - any experts?
Brilliant. :) Thank you, I'm going to give this a shot. On Jun 3, 3:33 pm, howesc how...@umich.edu wrote: skip the XML, use SOAP. that's my solution: profile_id = 42 merchantAuthentication={'name':api_login_id, 'transactionKey':transaction_key} from pysimplesoap.client import SoapClient #@TODO: can i cache the SoapClient object? client = SoapClient(wsdl=https://apitest.authorize.net/soap/v1/Service.asmx?WSDL;, exceptions=False) cust_profile = client.GetCustomerProfile( \ merchantAuthentication=merchantAuthentication, customerProfileId=profile_id) return cust_profile and now your response is a dict and you can just use it. i'm in the middle of an authorize.net CIM and AIM implementation, so lemme know if you have more questions, we can figure this out! cfh