[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread weheh
Very interesting. Yes, it makes sense now that I see for 1st time that models are being called for each every LOAD. Now it is obvious why browser refresh is slow for me! I am tracing it through and will let you know what I find. Thanks for the lead. On Aug 14, 6:04 pm, Massimo Di Pierro

[web2py] Re: Virtual Fields. Strange behavior when saving db result sets Build in types

2011-08-15 Thread Massimo Di Pierro
For the time being you can use this syntax: db=DAL() db.define_table('a',Field('b','integer')) for i in range(10): db.a.insert(b=i) def lazy(f): def g(self,f=f): import copy self=copy.copy(self) return lambda *a,**b: f(self,*a,**b) return g class Scale:

[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread weheh
Just as you predicted, kimosabe, there is a second pass through the action. I made an var in my model and assigned the env.path_info to it. Here's what I see in Eclipse: ... ENV_PATH_INFO str: /YAKiToMe/my_controller/my_action.load ENV_PATH_INFO (126270224) str:

[web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread fishwebby
Ok, it's good to know I'd need to use the pattern-matching router and not the parametric one. Basically what I'm trying to do is avoid having all my controllers in the one directory - in a recent Kohana project for example I had them split up in different subdirectories, according to user role:

[web2py] Re: new Reference.get (polymorphic with Row.get)

2011-08-15 Thread Massimo Di Pierro
in trunk. Thanks. On Aug 14, 8:52 pm, Carlos carlosgali...@gmail.com wrote: Hi Massimo, Can you please include the following in trunk for Reference?:     def get(self, key):         return self.__getattr__(key) This way, Reference and Row both respond to the 'get' method, polymorphism.

[web2py] Re: please help me test new form API

2011-08-15 Thread Massimo Di Pierro
I agree with you that having three ways to do the same thing is not good but: There are three reasons: 1) some people may want to validate without processing the form fully (no insert). shortcut to accepts(...dbio=True) 2) it allows to write onliners: form = SQLFORM().process() 3) no longer

[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread Massimo Di Pierro
If your view contains something like img src= / you would get a second call to the URL itself. On Aug 15, 2:44 am, weheh richard_gor...@verizon.net wrote: Just as you predicted, kimosabe, there is a second pass through the action. I made an var in my model and assigned the env.path_info to

[web2py] Re: downloads

2011-08-15 Thread peter
Thanks for your reply Anthony. That bit is actually working fine. I have put the album folder deliberately in web2py rather than within the application. This makes it easier to backup the application or the albums independently. I will explain my problem with an example. If I have a url

[web2py] Re: bulkloader web2py

2011-08-15 Thread howesc
Amnon, i'm using this in my bulkloader.yaml: - property: __key__ external_name: key export_transform: str import_transform: datastore.Key that seems to be working for me - it converts that key to its string hash on the way out and converts from the hash to the original

[web2py] Doing a select in a Virtual Field

2011-08-15 Thread Tom Coetser
Hi All, I'm new to web2py and am trying to get my mind around how virtual fields work. Given the following table: db.define_table(trip, Field(date, date), Field(odo, integer) ) which represents a trip taken by car on a specific date and the

[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread weheh
There is no img in this LOAD in particular. However, there is an image being downloaded in a separate LOAD during the refresh sequence. I don't see how it could affect this LOAD, could it? On Aug 15, 3:57 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: If your view contains something

[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread weheh
The view for the LOAD in question is here: {{=DIV( form.custom.begin, FIELDSET( form.custom.widget.text_field, _class='some-class', ), my_button(), form.custom.end, ) }} and my_button is defined: my_button(): return DIV( INPUT(

[web2py] Re: Problem with multiple forms

2011-08-15 Thread Karthik
Thanks weheh, that helped a lot! On Aug 14, 12:12 am, weheh richard_gor...@verizon.net wrote: Each form needs to have a unique name. I suppose you could use uuid to make a unique name. Then something like this pseudocode  might work: allforms=dict(form_id=new_form_id(),form=SQLFORM(...)) for

[web2py] Re: downloads

2011-08-15 Thread Anthony
On Monday, August 15, 2011 6:09:00 AM UTC-4, peter wrote: If I have a url .../default/my_download/abc.mp3?album=deffilename=ghi.mp3 Then it does correctly download web2py/albums/def/ghi.mp3 The popup for the user say 'do you want to open or save abc.mp3 I'm not sure web2py is doing

[web2py] navbar missing space before bracket

2011-08-15 Thread Richard
Hello, Would you correct this little glitch (gluon tools.py line 1101) : Change : bar = SPAN(prefix,self.user.first_name,' [ ', logout, ']',_class='auth_navbar') For : bar = SPAN(prefix,self.user.first_name,' [ ', logout, ' ]',_class='auth_navbar') Thanks Richard

[web2py] Birth Date

2011-08-15 Thread Re Fabro
Hello, dudes!! I want to know which the date of Birth of Web2Py and how many Years. :) * Obrigado, Renato Fabro* C2C Balloon - Humanizing Technology +55 (19) 3289-9610 http://www.c2cballoon.com

[web2py] weird errors about not finding classes / objects when multiple simultaneous requests from different browsers/sessions.

2011-08-15 Thread Carlos
Hi, I'm having some weird errors about web2py/python not finding classes / objects in my models when multiple simultaneous requests come from different browsers/sessions. I'm still running locally (not in production), using the latest web2y trunk on windows 7 with postgresql and rocket. My

Re: [web2py] GAE deployment issue on Ubuntu

2011-08-15 Thread Ramaseshan Ramachandran
It works for me on Ubuntu, though I am not on 11.04. If you have used multiple google accounts for upload, you may face issues of 404 error due to appcfg cache On Sunday, August 14, 2011, Pystar aitoehi...@gmail.com wrote: I just decided to use the appcfg.py tool to deploy my app and it was

[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread Massimo Di Pierro
No it should not. The extra request must come somewhere. Google Chrome can help. On Aug 15, 9:51 am, weheh richard_gor...@verizon.net wrote: There is no img in this LOAD in particular. However, there is an image being downloaded in a separate LOAD during the refresh sequence. I don't see how

[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread Anthony
Could it be in the containing page, or maybe some javascript that is adding to the DOM dynamically? Check the browser developer tools for outgoing requests. Anthony On Monday, August 15, 2011 10:56:19 AM UTC-4, weheh wrote: The view for the LOAD in question is here: {{=DIV(

[web2py] Re: Birth Date

2011-08-15 Thread Massimo Di Pierro
The first version was written in August 2007. It was made public on Oct 1, 2007. This group was created on Oct 19, 2007. We moved to Mercurial in Dec 4, 2009. Things have sped up a lot since than. Since 2007 web2py has doubled in size and more than 70% has been rewritten (while keeping backward

Re: [web2py] Re: Birth Date

2011-08-15 Thread Re Fabro
Thx... Perfect! 8) * Obrigado, Renato Fabro* C2C Balloon - Humanizing Technology +55 (19) 3289-9610 http://www.c2cballoon.com 2011/8/15 Massimo Di Pierro massimo.dipie...@gmail.com The first version was written in August 2007. It was made public on Oct 1, 2007. This group was created on

[web2py] Doing a select in a Virtual Field

2011-08-15 Thread pbreit
I think you might have to dereference r. Something like r[0].odo since queries return a set even if there's only one element.

[web2py] web2py.com starts

2011-08-15 Thread Massimo Di Pierro
total requests/day 07/Aug/2011 40024 08/Aug/2011 68275 09/Aug/2011 75787 10/Aug/2011 101568 11/Aug/2011 262590 12/Aug/2011 102468 13/Aug/2011 67747 14/Aug/2011 63734 distinct visitors/day 07/Aug/2011 1159 08/Aug/2011 1972 09/Aug/2011 2102 10/Aug/2011 2496 11/Aug/2011 5119 12/Aug/2011 2551

[web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread Rufus
I'm a newbie too, but I see myself also prettying up my URL's with routes.py. Is your routes.py in the correct directory? If it is in an application directory, it won't work. it should be in the web2py directory. A hint: You can always put print statements in any of your .py files to verify

[web2py] Re: bulkloader web2py

2011-08-15 Thread Amnon Khen
Thanks. It did the trick. I appreciate your help, Amnon On Aug 15, 3:53 pm, howesc how...@umich.edu wrote: Amnon, i'm using this in my bulkloader.yaml:     - property: __key__       external_name: key       export_transform: str       import_transform: datastore.Key that seems to be

[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread weheh
@ MDP Anthony: could you clarify, please? Are you saying that any image on the page from any other LOAD or containing HTML would trigger another pass through the LOADed action that's failing in my case? Or must the image actually be within the failing LOADed action/model/ view? On Aug 15, 12:38 

[web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread Anthony
On Monday, August 15, 2011 2:06:23 PM UTC-4, Rufus wrote: For your example, I would guess routes.py would look like: --- routes_in = ( ('admin/courses','init/admin_courses/index'),) routes_out = ( ('init/admin_courses/index',

Re: [web2py] weird errors about not finding classes / objects when multiple simultaneous requests from different browsers/sessions.

2011-08-15 Thread Marin Pranjic
It should not be an issue with mixing environments. Can you provide more information? Marin On Mon, Aug 15, 2011 at 6:27 PM, Carlos carlosgali...@gmail.com wrote: Hi, I'm having some weird errors about web2py/python not finding classes / objects in my models when multiple simultaneous

[web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread fishwebby
I tried your suggestion, with routes.py in the web2py directory, but alas it didn't work. Not sure what I'm doing wrong (nice suggestion about the print statement though to make sure it's working). Hmm... On Aug 15, 8:06 pm, Rufus rufusvsm...@gmail.com wrote: I'm a newbie too, but I see myself

Re: [web2py] weird errors about not finding classes / objects when multiple simultaneous requests from different browsers/sessions.

2011-08-15 Thread Carlos
Hi, I will provide more information in order to reproduce the problem, as soon as I can. But I just want to make sure: are the environments created by web2py fully independent in every single web request (even with multiple concurrent requests) ?. If anybody has more information or has

[web2py] Scope authenticated users in accounts

2011-08-15 Thread fishwebby
(web2py newbie here) - I've got user authentication working ok, but I'd like to be able to scope the auth_users inside an account. My plan is to have accounts identified by subdomains, e.g. account_one.example.com, and then inside that the users can login (a la Basecamp). I've got the following

[web2py] [TIP] dowloading attachments with AJAX

2011-08-15 Thread Michele Comitini
Suppose you want to make an AJAX call that starts a file download. How can you do that? 1. form submission 2. a element href 3. iframe Too complex! of course *web2py* comes to rescue... BIG NOTE: the following is based on 'data:' url type and was tested only on FF and chrome. I do not have IE

[web2py] Re: Scope authenticated users in accounts

2011-08-15 Thread Anthony
You might want to consider using this: https://groups.google.com/d/msg/web2py/NrvxeWQJvH0/wbafxppaf1QJ (note, 'request_precinct' has been changed to the more general 'request_tenant', as noted later in that thread). Otherwise, I suppose you could use the Auth groups functionality (

[web2py] Ace now powering GitHub edit

2011-08-15 Thread pbreit
https://github.com/blog/905-edit-like-an-ace

[web2py] Re: Scope authenticated users in accounts

2011-08-15 Thread pbreit
I wonder if you could write some sort of custom validator that checks that the subdomain matches auth.user.account_id?

[web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread pbreit
I'm a newbie and I try to avoid at all costs using routes.py just to re-organize my controllers. It's much safer, easier and predictable to organize controllers and functions to map directly to URLs. If you are moving from another system and want to make sure old users continue to be

[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread Anthony
As Massimo suggests, I think it would have to be a broken link, not just any image loading. However, I can't seem to replicate the problem even with a broken image link, so maybe Massimo can offer more detail. Anthony On Monday, August 15, 2011 2:31:40 PM UTC-4, weheh wrote: @ MDP Anthony:

Re: [web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread Jonathan Lundell
On Aug 15, 2011, at 11:38 AM, Anthony wrote: You should also be able to go to /admin/default/reload_routes to reload routes.py, but it looks like there is currently a bug that is causing that to fail. Any idea why (or how)?

Re: [web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread Jonathan Lundell
On Aug 15, 2011, at 1:20 PM, fishwebby wrote: I tried your suggestion, with routes.py in the web2py directory, but alas it didn't work. Not sure what I'm doing wrong (nice suggestion about the print statement though to make sure it's working). You can also revise the doctests in routes.py to

Re: [web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread Anthony
On Monday, August 15, 2011 5:14:01 PM UTC-4, Jonathan Lundell wrote: On Aug 15, 2011, at 11:38 AM, Anthony wrote: You should also be able to go to /admin/default/reload_routes to reload routes.py, but it looks like there is currently a bug that is causing that to fail. Any idea why (or

Re: [web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread Jonathan Lundell
On Aug 15, 2011, at 2:40 PM, Anthony wrote: On Monday, August 15, 2011 5:14:01 PM UTC-4, Jonathan Lundell wrote: On Aug 15, 2011, at 11:38 AM, Anthony wrote: You should also be able to go to /admin/default/reload_routes to reload routes.py, but it looks like there is currently a bug that

[web2py] Re: {{web2py_conflict}}

2011-08-15 Thread mikech
I will be interested to hear how this works out, as I'm also interested in Angular.

[web2py] Speeding up model execution for large models

2011-08-15 Thread Kevin Ivarsen
Hello, I'm using web2py with a relatively large legacy database. We have about 70 tables, and models/db.py is close to 1000 lines long. The problem I'm facing is that all of these Field() constructors and define_table() calls take about 150-200ms to execute, and this overhead occurs each time

[web2py] Re: Speeding up model execution for large models

2011-08-15 Thread Anthony
First, have you set migrate to False for all tables, and have you bytecode compiled the app? That should speed things up. Also, do you need all 70 tables for any requests, or can they be broken up based on the particular controller/function called? If so, you may speed things up with

[web2py] Re: Scope authenticated users in accounts

2011-08-15 Thread fishwebby
Fantastic, the request_tenant method is just what I was looking for! So this is what I've got working: def requires_account(f): Redirect to the account not found page if there is no account (decorator function) if not get_account(): redirect(URL('accounts',

[web2py] Re: Speeding up model execution for large models

2011-08-15 Thread Kevin Ivarsen
Hi Anthony, Thanks for the quick response. I do use migrate=False already. I have not tried bytecode compiling the app, but earlier today I did a quick test: I wrapped the contents of my long db.py in an if False: block (causing it to compile, but not run, the code for each request), and

[web2py] Re: can I turn off the auto back-references?

2011-08-15 Thread Carlos
Hi Massimo, Can you please let me know if this switch can be implemented in web2py?. Many thanks, Carlos

[web2py] Re: Speeding up model execution for large models

2011-08-15 Thread Anthony
This thread from the developers list a few months ago may interest you: https://groups.google.com/d/topic/web2py-developers/rYKg1TUXem0/discussion Anthony On Monday, August 15, 2011 8:18:30 PM UTC-4, Kevin Ivarsen wrote: Hi Anthony, Thanks for the quick response. I do use migrate=False

[web2py] migrate file system uploads to database?

2011-08-15 Thread Mothmonsterman
Hello, I read the docs and searched the posts to see if there was an easy way to migrate file system uploads to database. I could not find anything.. Please excuse me if I missed something obvious, but does anyone know of a way to accomplish this in a batch process? Thanks. Patrick

[web2py] Re: can I turn off the auto back-references?

2011-08-15 Thread pbreit
I think you can also do: myrow.fieldname or othervalue

[web2py] Re: can I turn off the auto back-references?

2011-08-15 Thread Carlos
Hi pbreit, Thanks for your input, but that will not work, since row.fieldname still incorrectly returns the Set object (therefore not executing the 'or' statement). Secondly, fieldname is a str variable in my case, which can't be used directly with the dot notation. I just need to not have

[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread weheh
Massimo, can you be more explicit? What do you suggest using in Chrome that will help? What tool should I be using to look for this? I mostly use Firebug in Firefox and Eclipse for debugging. Sometimes use Chrome for inspecting elements but not much else. On Aug 15, 12:38 pm, Massimo Di Pierro

[web2py] Re: component-generated field not getting accepted first time

2011-08-15 Thread weheh
Firebug shows only 1 outgoing request to each of the .load actions on the page, including the offending one. I've checked for broken links and there are none. I'm checking but I'm 99.999% confident there is no js adding to the DOM with respect to this form. If it helps, you can see the problem

Re: [web2py] Doing a select in a Virtual Field

2011-08-15 Thread Tom Coetser
On Monday 15 August 2011 19:47:09 pbreit wrote: I think you might have to dereference r. Something like r[0].odo since queries return a set even if there's only one element. From my tests, the .first() in the query: r = db(q).select(db.trip.odo, orderby=o, limitby=(0,1)).first() seems to

Re: [web2py] Doing a select in a Virtual Field

2011-08-15 Thread pbreit
Oh, yeah, that's right. Sorry about that. I suspect the problem could indeed be with a query in a virtual field but I don't know enough about it to say for sure. Another option might be to implement it as just a regular function.

[web2py] Re: Speeding up model execution for large models

2011-08-15 Thread Kevin Ivarsen
Very interesting reading Anthony - thanks for the link. Kevin On Aug 15, 6:27 pm, Anthony abasta...@gmail.com wrote: This thread from the developers list a few months ago may interest you:https://groups.google.com/d/topic/web2py-developers/rYKg1TUXem0/discu... Anthony On Monday,