[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread ron_m
Is there any value in this article for your case? http://code.activestate.com/recipes/519621-object-finalization-without-__del__-and-without-ha/ Ron

[web2py] Re: web2py book

2011-01-08 Thread cjrh
On Jan 7, 10:20 pm, puercoespin jzaragoza.puercoes...@gmail.com wrote: Is there an errata file of the printed book? Because Lulu's book has many errors, and I have to be in comparison to the online version of it. Not an official one, as far as I know, but there are community members who keep

[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-08 Thread cjrh
On Jan 7, 11:45 pm, Michele Comitini michele.comit...@gmail.com wrote: I think the most misunderstood fact with web2py is that web2py implementation is improving every day, Do you really think the designers of other web frameworks do not understand how web2py works? They definitely understand,

[web2py] Re: Running PHP on top of Web2Py

2011-01-08 Thread jeff
I had another idea which is a simplification on my first one : an action acting like a proxy on the php server. I just wrote a little POC that seems to work. Here are the few lines to put in a controller: import urllib def make_get_stuff(an_url): def get_stuff():

[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-08 Thread Anthony
+1 On Saturday, January 8, 2011 7:31:38 AM UTC-5, cjrh wrote: On Jan 7, 11:45 pm, Michele Comitini michele@gmail.com wrote: I think the most misunderstood fact with web2py is that web2py implementation is improving every day, Do you really think the designers of other web

[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-08 Thread Anthony
On Saturday, January 8, 2011 9:12:55 AM UTC-5, Anthony wrote: +1 On Saturday, January 8, 2011 7:31:38 AM UTC-5, cjrh wrote: On Jan 7, 11:45 pm, Michele Comitini miche...@gmail.com wrote: I think the most misunderstood fact with web2py is that web2py implementation is improving every

[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-08 Thread pbreit
I think we could do ourselves a favor by taking the feedback seriously and not being so dismissive of criticism. There are pros and cons of the various approaches and we happen to think Web2py's design decisions have good merit. Hiding behind DRY for the importing situation is not productive.

[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-08 Thread Anthony
On Saturday, January 8, 2011 9:53:18 AM UTC-5, pbreit wrote: I think we could do ourselves a favor by taking the feedback seriously and not being so dismissive of criticism. There are pros and cons of the various approaches and we happen to think Web2py's design decisions have good merit.

[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread Massimo Di Pierro
The change in trunk fixes the problem for every class that does not have a __del__ attribute. Classes that have a __del__ attribute may cause a memory leak (on cpython, not on jython). On Jan 7, 11:41 pm, Anthony abasta...@gmail.com wrote: As far as I can tell, the change in trunk didn't have

[web2py] Shell bug

2011-01-08 Thread LightOfMooN
web2py Shell Version 1.91.6 (2011-01-03 17:55:14) In [1] : a = [] In [2] : a.append(1) In [3] : a [] fix pls

[web2py] SQL injection and web2py - solution

2011-01-08 Thread David Austin
Hi, I think I've narrowed down the problem - web2py doesn't escape backslashes in its SQL strings. Everything I found on the web said that backslashes had to be escaped for SQL (though I couldn't confirm this with an official document). My solution is to add escaping of backslashes to the last

[web2py] SQL injection and web2py

2011-01-08 Thread David Austin
Hi, I'm using web2py for a modest project but can't understand how web2py protects against trivial SQL injection attacks. I'm using a postgresql backend. I was trying (for legitimate reasons) to store a backslash in a text field. It appears that web2py does nothing at all with backslashes and

[web2py] Re: SQL injection and web2py - solution

2011-01-08 Thread Massimo Di Pierro
This is what I get from shell: db=DAL() db.define_table('x',Field('y')) db.x.insert(y='hello\world') 1 print db.x[1] Row {'update_record': function lambda at 0x17279b0, 'y': 'hello\ \world', 'id': 1, 'delete_record': function lambda at 0x17279f0} Which version of postgresql are you using?

[web2py] Re: Shell bug

2011-01-08 Thread Massimo Di Pierro
In 1.91.1 we moved from our own shell to the google shell: http://shell.appspot.com/ this is because the google shell works on google app engine. The problem is that the bug is in the google shell which we use (you can reproduce the problem there). I have submitted a bug report to the authors a

Re: [web2py] Re: Running PHP on top of Web2Py

2011-01-08 Thread Jonathan Lundell
On Jan 8, 2011, at 5:43 AM, jeff wrote: And I have obviously to write some lines in routes.py like (the proxy action is in the w.py controller of the poc app): (r'.*:http://.*:.* /(?Pany(?:admin/|poc/).*)', r'/\gany'), (r'.*:http://.*:.* /(?Pany.*)', r'/poc/w/proxy/vars=\gany'), # I

[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread VP
Without actually trying it, but it still seems the cause for memory leak of (A) and (B) is different. (B) is a case of circular reference, and as such reference counting garbage collection (cpython) will fail to work properly. But (A), which is the leak in web2py, does not seem to related to

[web2py] Re: Shell bug

2011-01-08 Thread LightOfMooN
thx ;) On 8 янв, 20:59, Massimo Di Pierro massimo.dipie...@gmail.com wrote: In 1.91.1 we moved from our own shell to the google shell: http://shell.appspot.com/ this is because the google shell works on google app engine. The problem is that the bug is in the google shell which we use (you

Re: [web2py] Re: new URL router release candidate

2011-01-08 Thread Jonathan Lundell
On Jan 7, 2011, at 1:56 PM, VP wrote: Thanks. What if I have something like this: example1.com /app1/controller1 example1.net /app1/controller2 How would this translate into this new syntax? I've been thinking about this one a little more, and I see a problem. When we rewrite

[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread ron_m
I don't get why there is a problem. I did a scan of the latest trunk and did not find a __del__ function anywhere. If the sample code is run with the __del__ it accumulates memory rapidly. Comment out the __del__ method which does nothing in this example and the memory accumulation is no

[web2py] computed fields and SQLFORM

2011-01-08 Thread howesc
Let's say i have a table like: db.define_table('item_quantity', Field('item', db.item, requires=IS_IN_DB(db, db.item.id,'%(name)s'), represent=lambda x: x.name), Field('quantity', 'double', notnull=True, default=0.0, comment=in ounces), Field('name', length=500,

[web2py] 2 tables, one drop down, 1 form, and 1 sub-form

2011-01-08 Thread mart
Hi, would anyone have a suggestion with the following. CONTEXT: For most remote employees, visibility and easy communication can be a challenge. Showing status on work items, requests and work load (items queued up) is essential (someone had referred to this as optics). SInce this is my case,

[web2py] Limitations in a multiuser linux environment (or Debian packaging issues)

2011-01-08 Thread Jos? L.
Hi, I'm working (much slower than what I'd like because of Real World issues) in the packaging of web2py. Most of the work is done, excepting for a recurrent problem: permissions Trying to fullfil the FHS ( http://wiki.debian.org/FilesystemHierarchyStandard ) , I've moved the gluon libraries to

Re: [web2py] Limitations in a multiuser linux environment (or Debian packaging issues)

2011-01-08 Thread Jonathan Lundell
On Jan 8, 2011, at 11:29 AM, Jos? L. wrote: Anyway I know I'll have to patch the admin application in order to remove the remote upgrade of web2py as this option is not allowed in Debian packages (it's removed from firefox or openoffice too). Perhaps this should be a configuration option of

[web2py] Apache, Wsgi problem

2011-01-08 Thread VP
We occasionally got an Apache error so the page didn't get displayed. So I decided to stress test using Apache Bench (ab). It seems the site suffered failure up to 50-100 concurrent connection. Apache error log showed this error: Premature end of script headers: wsgihandler.py After digging

[web2py] SQL restrictions and default at database level

2011-01-08 Thread Martin H
Hi, I've defined my table with certain restrictions and default values. For example set some fields as required, and some have default values. When I look at the table schema that it created, the default values and restrictions aren't set at the database level. Is there a way to do this with

Re: [web2py] Re: Can any help me with new dal in trunk?

2011-01-08 Thread Thadeus Burgess
All I know is that tables are issued as lowercase, but you can still access your table as an uppercase attribute. There is an inconsistency in the DAL somewhere because of this... Somewhere it is forgetting to convert to lower case. I don't know why converting table names to lower case is forced

[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread Anthony
Sorry, I wasn't paying attention -- I had put the code in there prior to the issue about __del__ being raised. The leak is now gone in my testing. Thanks. Anthony On Saturday, January 8, 2011 10:43:13 AM UTC-5, Massimo Di Pierro wrote: The change in trunk fixes the problem for every class

[web2py] Re: Learning Management System survey

2011-01-08 Thread Anthony
Looks like there's a lot of dissatisfaction with Blackboard (and Moodle): http://www.reddit.com/r/programming/comments/eye4y/shame_on_you_blackboard/

[web2py] how to change keys in dict to response?

2011-01-08 Thread LightOfMooN
i have some tables to rate files by week, month, year etc.. i have some function like this: def index(): if request.args(0) == 'all': rolics = db(db.rolic.id==db.rating_all.rolic_id).select(db.rolic.all, db.rating_all.rating, orderby=~db.rating_all.rating) elif request.args(0) ==

[web2py] Re: computed fields and SQLFORM

2011-01-08 Thread Massimo Di Pierro
Wouldn't this be misleading because the computed field depends on the value of fields that may have been edited? On Jan 8, 12:25 pm, howesc how...@umich.edu wrote: Let's say i have a table like: db.define_table('item_quantity',   Field('item', db.item,         requires=IS_IN_DB(db,

[web2py] Re: Limitations in a multiuser linux environment (or Debian packaging issues)

2011-01-08 Thread Massimo Di Pierro
I will add it. On Jan 8, 1:38 pm, Jonathan Lundell jlund...@pobox.com wrote: On Jan 8, 2011, at 11:29 AM, Jos? L. wrote: Anyway I know  I'll have to patch the admin application in order to remove the remote upgrade of web2py as this option is not allowed in Debian packages (it's removed

[web2py] Re: SQL restrictions and default at database level

2011-01-08 Thread Massimo Di Pierro
what db engine? varchar should be the default. You can use Field('modified_on''datetime',update=request.now,writable=False) to timestamp on update. On Jan 8, 2:54 pm, Martin H helpmh...@gmail.com wrote: Hi, I've defined my table with certain restrictions and default values. For example set

[web2py] Re: Can any help me with new dal in trunk?

2011-01-08 Thread Massimo Di Pierro
We should have a flag to change this behavior DAL(...,lowercase=True). I would take a patch. On Jan 8, 2:58 pm, Thadeus Burgess thade...@thadeusb.com wrote:  All I know is that tables are issued as lowercase, but you can still access your table as an uppercase attribute. There is an

[web2py] Re: how to change keys in dict to response?

2011-01-08 Thread LightOfMooN
i have one solution like this: d = dict(rolics=rolics) for row in d['rolics']: row['rating']=row['rating_all'] return response.render('default/main.html', d) but it seems some stupid :)

[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread Massimo Di Pierro
Two ingredients case a memory leak in ANY python program: __del__ and circular references. You need them both. In the case of web2py exec code in {} creates the circular reference for objects defined in the code. This does not mean web2py has a memory leak. In fact, as pointed out, no web2py

[web2py] Re: SQL restrictions and default at database level

2011-01-08 Thread Martin H
I am using sqlite right now. My app will eventually be running in MySQL and sqlite.

[web2py] Re: SQL restrictions and default at database level

2011-01-08 Thread Massimo Di Pierro
On mysql, web2py uses varchar. On sqlite there is no difference (sqlite does not enforce field types anyway). Massimo On Jan 8, 4:55 pm, Martin H helpmh...@gmail.com wrote: I am using sqlite right now. My app will eventually be running in MySQL and sqlite.

[web2py] Re: SQL restrictions and default at database level

2011-01-08 Thread Martin H
What about the restrictions and default values? I would like to have default values and restrictions like required and unique be set at the database level so that when working on it by hand, defaults are there are well as restrictions. Is there a way to set those in web2py so that it creates

[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread Anthony
On Saturday, January 8, 2011 5:48:06 PM UTC-5, Massimo Di Pierro wrote: Two ingredients case a memory leak in ANY python program: __del__ and circular references. You need them both. In the case of web2py exec code in {} creates the circular reference for objects defined in the code.

Re: [web2py] Re: on a possible web2py memory leak

2011-01-08 Thread Jonathan Lundell
On Jan 8, 2011, at 2:48 PM, Massimo Di Pierro wrote: In the case of web2py exec code in {} creates the circular reference for objects defined in the code. What is the circular reference?

[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread Massimo Di Pierro
def f(): pass ... f.func_globals {'A': class __main__.A at 0x465d20, 'a': __main__.A instance at 0x470260, 'f': function f at 0x46a630, '__builtins__': module '__builtin__' (built-in), '__name__': '__main__', '__doc__': None} globals() {'A': class __main__.A at 0x465d20, 'a': __main__.A

Re: [web2py] Re: Running PHP on top of Web2Py

2011-01-08 Thread John-Kim Murphy
From your original message, I was assuming you did not wish to run a PHP server at all. If running a PHP server is allowed, it is possible to run Web2Py and PHP side-by-side, in parallel: - http://web2py.relevantmatter.com/welcome/ - http://web2py.relevantmatter.com/presite/phpinfo.php3

[web2py] iframes and ajax

2011-01-08 Thread weheh
I have a componentized system with an upload field which I load into an iframe. When I fill in the form component and click submit, the file gets uploaded properly. However, I also have an ajax function that is supposed to trigger the updating of other parts of the screen, but it doesn't work. I

[web2py] Re: Apache, Wsgi problem

2011-01-08 Thread Graham Dumpleton
You were possibly using a an old version of sqlite which isn't safe to use in a multithreaded configuration. The MPM settings are not going to help in this case as that error could only come about because you are using mod_wsgi daemon mode and so application is running in distinct process and

[web2py] Re: iframes and ajax

2011-01-08 Thread weheh
I should also note that the divs I'm trying to update are outside the iframe.

[web2py] Re: Apache, Wsgi problem

2011-01-08 Thread Anthony
Graham, welcome. Careful, though -- we might converthttp://twitter.com/GrahamDumpleton/status/23120780938190848you. ;-) http://twitter.com/GrahamDumpleton/status/23120780938190848 On Saturday, January 8, 2011 10:59:37 PM UTC-5, Graham Dumpleton wrote: You were possibly using a an old

[web2py] Re: Guido released a new DataStore API for GAE

2011-01-08 Thread dspiteself
This is beautiful. @Massimo check this out it has a potential for a huge effect on the request latency if the database supports async requests. Postgres does. Imagine your views if the supported futures and rendered the template as results from the database and tasklets became available. You can

[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread ron_m
Thanks for the extra explanation.

[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread ron_m
You have to have a __del__ method in the class to get the leak

Re: [web2py] Re: Drupal alternatives in Python or web2py

2011-01-08 Thread David Bain
Let me second the Plone for CMS/Web2py for rapid apps meme. I'm also a regular user of Plone and Plone 4 is excellent. Point of trivia, while Plone latest release has gotten faster, Drupal's latest release has gotten slower. Anyway I've had to dive into web2py because it was the best choice for

[web2py] Re: on a possible web2py memory leak

2011-01-08 Thread ron_m
To get the leak the __del__method has to be in the class. The gc.collect() as suggested by Massimo cured the leak for the exec code case I believe because gc.collect() runs a test on the objects to see if there are any external references, finds none, and therefore allows them to be removed

[web2py] Re: Apache, Wsgi problem

2011-01-08 Thread Graham Dumpleton
On Sunday, January 9, 2011 3:54:37 PM UTC+11, Anthony wrote: Graham, welcome. Careful, though -- we might converthttp://twitter.com/GrahamDumpleton/status/23120780938190848you. ;-) http://twitter.com/GrahamDumpleton/status/23120780938190848 I have been posting here for quite a long

[web2py] Re: Guido released a new DataStore API for GAE

2011-01-08 Thread Massimo Di Pierro
Currently the DAL does not support async but I guess we can add support for it. I will take a closer look in the next few days. On Jan 8, 11:25 pm, dspiteself dspites...@gmail.com wrote: This is beautiful. @Massimo check this out it has a potential for a huge effect on the request latency if

[web2py] Re: Apache, Wsgi problem

2011-01-08 Thread Massimo Di Pierro
Graham. We all appreciate your expertise here and appreciate people who say what they think. Perhaps diplomacy is not our strength. You do not need to justify your tweet. I though it was funny because - in my view - it would apply equally well to some of the other frameworks. On Jan 9, 12:24 am,

[web2py] Inserting additional fields in crud

2011-01-08 Thread Martin H
Hi, I am creating a form for adding user accounts. My model has a password field. In the form, I would like to add a 'repeat password' field, but I don't want to store that in the database. I can't seem to find a way to add a form field in crud or SQLFORM. Is my only option to manually create

[web2py] Re: Apache, Wsgi problem

2011-01-08 Thread Graham Dumpleton
On Sunday, January 9, 2011 6:05:16 PM UTC+11, Massimo Di Pierro wrote: Graham. We all appreciate your expertise here and appreciate people who say what they think. Perhaps diplomacy is not our strength. You do not need to justify your tweet. I though it was funny because - in my view -

[web2py] Getting the field value of a form field

2011-01-08 Thread Kenneth Lundström
Hello, I´m creating a form with SQLFORM(db.t_order, order_id) so I get a form with values. As the data has been queried from the database I´d like to get a value from one of the fields a do some customization based on it. But how do I get the value of field f_sum from the form? Kenneth