[web2py:34160] Re: plugin system again

2009-10-29 Thread Yarko Tymciurak
On Fri, Oct 30, 2009 at 1:12 AM, mdipierro wrote: > > Those book cost too much. > ... and probably not generally so useful; Nam (I think) was a friend of Reinke's/Baskin's (who wrote the paper on Role of Finiteness in Emergence of Structure) Suh was (is?) head of Mechanical Eng. @ MIT; we

[web2py:34159] Re: web2py uglyness

2009-10-29 Thread Yarko Tymciurak
...you can review (and comment on) this in gluon/colmpileapp.py... In general, this is an important step towards one kind of application specific plugin (application activated, as compared to available at each application request, or as part of gluon-level activation for availability to any/all ap

[web2py:34158] Re: plugin system again

2009-10-29 Thread mdipierro
Those book cost too much. We really need to resolve this over a beer. is the only thing you are asking to keep plugins files under a separate folder? How would the plugin be able to override the layout.html? How would it be able to overwrite a module (for example a local customized version of s

[web2py:34157] Re: GAE caching

2009-10-29 Thread Robin B
You are right, the queue.py code should be put in gaehandler.py. I have cleaned up the code and posted it here: http://appengine-cookbook.appspot.com/recipe/hot-handler It might be a good idea to disable it (comment it out) by default since it could confuse developers when they try to look at t

[web2py:34156] web2py uglyness

2009-10-29 Thread mdipierro
Something always bothered be and resulted in lots of uglyness. I suspected there was a way to fix it but did not know. Now I found out. The problem: == when we do import a.b.c as d Python (and web2py) look in sys.path. If the module is in "web2py/applications/yourapp/modules" then

[web2py:34155] Re: plugin system again

2009-10-29 Thread Yarko Tymciurak
or perhaps (better) Chapter 4 in http://www.amazon.com/Principles-Design-Oxford-Advanced-Manufacturing/dp/0195043456/ On Fri, Oct 30, 2009 at 12:39 AM, Yarko Tymciurak < resultsinsoftw...@gmail.com> wrote: > see, for example, sections 1.7.5 - 1.7.6 in > http://www.amazon.com/Axiomatic-Design-Adva

[web2py:34154] Re: plugin system again

2009-10-29 Thread Yarko Tymciurak
see, for example, sections 1.7.5 - 1.7.6 in http://www.amazon.com/Axiomatic-Design-Advances-Applications-Manufacturing/dp/0195134664 On Fri, Oct 30, 2009 at 12:32 AM, Yarko Tymciurak < resultsinsoftw...@gmail.com> wrote: > On Thu, Oct 29, 2009 at 11:21 PM, mdipierro wrote: > >> >> Let's say we we

[web2py:34153] Re: GAE caching

2009-10-29 Thread mdipierro
Let's if I understand. 1) we copy queue.py in gluon.contrib 2) we edit the web2py app.yaml to include the above modification so that that url is served by queue.py not web2py 3) google keeps calling itself and the entire web2py app gets cached? Massimo On Oct 30, 12:30 am, Robin B wrote: > L

[web2py:34152] Re: how to generate absolute url ?

2009-10-29 Thread mdipierro
Sorry. I misunderstood. create a file web2py/routes.py and in it write routes_out=[('/admin/(?P.*)','https://hostname/admin/\g')] where hostname is your hostname or ip address and port. On Oct 29, 11:46 pm, akonsu wrote: > Massimo, > > thanks for taking time to explain. > > my question is not

[web2py:34151] Re: plugin system again

2009-10-29 Thread Yarko Tymciurak
On Thu, Oct 29, 2009 at 11:21 PM, mdipierro wrote: > > Let's say we were to create a new folder called applications/*/ > plugins, put stuff in there and modify web2py to handle the code in > there in some special way. That the current mechanism in admin for > packing, unpacking, deleting would st

[web2py:34150] Re: GAE caching

2009-10-29 Thread Robin B
Looks like google exponentially backs off a task when it fails, so here is a version that uses eta to schedule the next task 10s in the future. ### in queue.yaml queue: - name: default rate: 20/m bucket_size: 1 ### in app.yaml handlers: - url: /_ah/queue/default script: queue.py login: a

[web2py:34149] Re: GAE caching

2009-10-29 Thread Robin B
I looked at the docs and came up with this code: ### somehow run this code once to insert atleast one task in the queue from google.appengine.api.labs import taskqueue taskqueue.add(url='/_ah/queue/default') # will return 404 ### add this to queue.yaml queue: - name: default rate: 10/m bucke

[web2py:34148] Re: how to generate absolute url ?

2009-10-29 Thread akonsu
Massimo, thanks for taking time to explain. my question is not about running admin over https or http and how web2py detects this, or how to connect to admin using ssh. i was just wondering how to emit the correct url. right now the default hello world app emits relative url for the admin and th

[web2py:34147] Re: renaming validators

2009-10-29 Thread mdipierro
LOL On Oct 29, 11:01 pm, "mr.freeze" wrote: > And that's why you're the man. Thanks! > > On Oct 29, 10:58 pm, mdipierro wrote: > > > why do you need execs? > > > import gluon.validators > > for key in dict(gluon.validators): > >     globals()[key.lower()]=gluon.validators.__dict__[key] > > > On

[web2py:34146] Re: how to generate absolute url ?

2009-10-29 Thread mdipierro
Not quite. If you are not using a proxy than web2py takes care of this automatically. web2py detects https and admin will not work without. If you are using a proxy web2py admin cannot detect https and thinks it is running from localhost. There is no way to prevent admin from going over http and

[web2py:34145] Re: plugin system again

2009-10-29 Thread mdipierro
Let's say we were to create a new folder called applications/*/ plugins, put stuff in there and modify web2py to handle the code in there in some special way. That the current mechanism in admin for packing, unpacking, deleting would still work. It is because plugins in a subfolder are simply more

[web2py:34144] Re: renaming validators

2009-10-29 Thread mr.freeze
And that's why you're the man. Thanks! On Oct 29, 10:58 pm, mdipierro wrote: > why do you need execs? > > import gluon.validators > for key in dict(gluon.validators): >     globals()[key.lower()]=gluon.validators.__dict__[key] > > On Oct 29, 10:49 pm, "mr.freeze" wrote: > > > That makes sense.

[web2py:34143] Re: renaming validators

2009-10-29 Thread mdipierro
why do you need execs? import gluon.validators for key in dict(gluon.validators): globals()[key.lower()]=gluon.validators.__dict__[key] On Oct 29, 10:49 pm, "mr.freeze" wrote: > That makes sense.  With that in mind, if I am doing this for my own > convenience is doing this with exec too co

[web2py:34142] Re: how to generate absolute url ?

2009-10-29 Thread akonsu
On Oct 29, 11:41 pm, mdipierro wrote: > Yes you can. read the routes.examples.py file. > thanks, you are saying that rather than emitting the absolute url that includes https prefix in the markup i need to map the admin url to https in my routes, right? konstantin --~--~-~--~~--

[web2py:34141] Re: plugin system again

2009-10-29 Thread Yarko Tymciurak
Well, drupal is dealing with PHP - and defining a "standard" interface for plugins to implement; this is sort of ... I dunno, interesting messy??? ok (???) - anyway, this is a general approach (not sure how much useful it has to show for web2py). Right now, plugins in web2py are hidden on

[web2py:34140] Re: renaming validators

2009-10-29 Thread mr.freeze
That makes sense. With that in mind, if I am doing this for my own convenience is doing this with exec too costly on performance or unsafe? On Oct 29, 10:31 pm, mdipierro wrote: > There is a reason for UPPERCASE. All the web2py API that are defined > outside the thread are uppercase. Those defi

[web2py:34139] Re: how to generate absolute url ?

2009-10-29 Thread mdipierro
On Oct 29, 10:26 pm, akonsu wrote: > hello, > > i have discovered web2py just yesturday. so i am completely new, > please forgive my ignorance. (currently i am using django but i am > almost convinced now that i need to switch to web2py :) but one thing > that bothers me so far is that after i in

[web2py:34138] how to generate absolute url ?

2009-10-29 Thread akonsu
hello, i have discovered web2py just yesturday. so i am completely new, please forgive my ignorance. (currently i am using django but i am almost convinced now that i need to switch to web2py :) but one thing that bothers me so far is that after i installed web2py on my webfaction share it seems

[web2py:34137] Re: GAE caching

2009-10-29 Thread mdipierro
do you have an example of code? On Oct 29, 10:16 pm, Robin B wrote: > > neat - now I get it. That's a nice hack! > > Did you find that out from the Google App Engine group, or thought of > > it yourself? > > Thought of it myself. > > Robin > > On Oct 29, 12:09 am, Richard wrote: > > > neat - no

[web2py:34136] Re: renaming validators

2009-10-29 Thread mdipierro
There is a reason for UPPERCASE. All the web2py API that are defined outside the thread are uppercase. Those defined in the thread are lowercase. This means you should treat the uppercase ones as constants and not change class attributes or your app will affect other apps. Massimo On Oct 29, 9:4

[web2py:34135] Re: Distributed Transactions

2009-10-29 Thread mdipierro
Since we are discussing this. I have added distributed transaction support for mysql and firebird (postgresql was already there). Example: db1=DAL('postgres://...') db2=DAL('mysql://...') db3=DAL('firebird://...') SQLDB.distributed_transaction_begin(db1,db2,db3) db1.table.insert() db2.table.

[web2py:34134] Re: Hierarchy

2009-10-29 Thread mdipierro
I meant to say you can do db.define_table('y',Field('x','reference y')) but not db.define_table('y',Field('x','reference z')) db.define_table('z',..) you can only reference a table defined or being defined not a table that will be defined. On Oct 29, 8:49 pm, DenesL wrote: > On 29 oct, 10:13

[web2py:34133] Re: GAE caching

2009-10-29 Thread Robin B
> neat - now I get it. That's a nice hack! > Did you find that out from the Google App Engine group, or thought of > it yourself? Thought of it myself. Robin On Oct 29, 12:09 am, Richard wrote: > neat - now I get it. That's a nice hack! > Did you find that out from the Google App Engine group,

[web2py:34132] Re: renaming validators

2009-10-29 Thread mr.freeze
Sorry, meant separated with underscores. On Oct 29, 9:42 pm, "mr.freeze" wrote: > I love web2py, but I hate the convention of all uppercase separated > with commas in validators.  It's like hitting a speed bump when you're > doing 80. I am experimenting with converting them to camelcase in my >

[web2py:34131] renaming validators

2009-10-29 Thread mr.freeze
I love web2py, but I hate the convention of all uppercase separated with commas in validators. It's like hitting a speed bump when you're doing 80. I am experimenting with converting them to camelcase in my model and it seems to work fine. def camelcase_validators(): from gluon.validators im

[web2py:34130] Re: tinyMCE output being escaped

2009-10-29 Thread mdipierro
Can you print to console the post.body? perhpas it is stored escaped for some reason. On Oct 29, 8:33 pm, Nick Jennings wrote: > Hello All, > >  I'm writing a simple blog and using tinyMCE for text formatting. > Saving it to the database works fine, but when I try to view it, the > XHTML is esca

[web2py:34129] Re: Distributed Transactions

2009-10-29 Thread Thadeus Burgess
So if two tables need to be joined often, keep them on the same database. Cool, thanks! :) -Thadeus On Thu, Oct 29, 2009 at 8:18 PM, mdipierro wrote: > > I am not aware of any any system that allows joins across databases. I > do not think it is a well defined concept since if information

[web2py:34128] Re: Hierarchy

2009-10-29 Thread DenesL
On 29 oct, 10:13, mdipierro wrote: > It workd for self references but not if y is yet to be defined. huh? self reference means 'y' is being defined. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users"

[web2py:34127] tinyMCE output being escaped

2009-10-29 Thread Nick Jennings
Hello All, I'm writing a simple blog and using tinyMCE for text formatting. Saving it to the database works fine, but when I try to view it, the XHTML is escaped. In the book it says I can use the XML function to specify I do not want the content escaped. In my simple blog, In the default/show.

[web2py:34126] Re: Distributed Transactions

2009-10-29 Thread mdipierro
I am not aware of any any system that allows joins across databases. I do not think it is a well defined concept since if information reside in distinct places there is no way to guarantee referential integrity. In web2py you can have tables in distinct with records that reference each other usin

[web2py:34125] Re: run 2 web2pys with wsgihandler/apache

2009-10-29 Thread Graham Dumpleton
On Oct 30, 9:44 am, Wes James wrote: > Is there a way to do this? > > WSGIScriptAliasMatch ^/(app|admin)(/.*)?$ > /opt/web2py-1.69.1/wsgihandler.py/$1$2 > WSGIScriptAliasMatch ^/(app2|admin2)(/.*)?$ > /opt/web2py-1.68.1/wsgihandler.py/$1$2 > > I was trying this earlier and it was kind of glitc

[web2py:34124] Re: Distributed Transactions

2009-10-29 Thread Thadeus Burgess
Is this a limitation of using a distributed database system, or just not having support in the DAL for this yet. -Thadeus $ On Thu, Oct 29, 2009 at 5:14 PM, mdipierro wrote: > > On Oct 29, 4:54 pm, Thadeus Burgess wrote: > > So you would have to insert records for each object individually,

[web2py:34123] Re: web2py book, correction

2009-10-29 Thread Nick
Ah, looks like it's already been caught. :) I'll remember that errata if I see anything else though. Cheers, Nick On Oct 30, 12:30 am, mdipierro wrote: > Thank you Nick. Would you mind adding it here? > > http://wiki.web2py.com/Errata_for_web2py_2nd_Edition_Book > > Massimo > > http://wiki.web2p

[web2py:34122] Re: web2py book, correction

2009-10-29 Thread mdipierro
Thank you Nick. Would you mind adding it here? http://wiki.web2py.com/Errata_for_web2py_2nd_Edition_Book Massimo http://wiki.web2py.com On Oct 29, 6:28 pm, Nick wrote: > Hi All, > >  Not sure where this should be reported, but I found what appears to > be a minor error in the web2py book. > >

[web2py:34121] web2py book, correction

2009-10-29 Thread Nick
Hi All, Not sure where this should be reported, but I found what appears to be a minor error in the web2py book. On page 70, the crud example of form handling should use db.comment as the first param to crud.create, not db.image. (since it's supposed to be a form that handles comments for the i

[web2py:34120] Re: problems with t3 going from 1.68.1 to 1.69.1

2009-10-29 Thread mdipierro
Fixed in trunk. I had to study to fix this one. This is a major problem and calls for a new release asap. If it fixes it for you I will release. Massimo On Oct 29, 5:37 pm, mdipierro wrote: > Auch this is a major problem. It is a breakage of backward > compatibility due to one of the new functi

[web2py:34119] run 2 web2pys with wsgihandler/apache

2009-10-29 Thread Wes James
Is there a way to do this? WSGIScriptAliasMatch ^/(app|admin)(/.*)?$ /opt/web2py-1.69.1/wsgihandler.py/$1$2 WSGIScriptAliasMatch ^/(app2|admin2)(/.*)?$ /opt/web2py-1.68.1/wsgihandler.py/$1$2 I was trying this earlier and it was kind of glitchy. Is there a better way to do this? I took the 1.68

[web2py:34118] Re: problems with t3 going from 1.68.1 to 1.69.1

2009-10-29 Thread mdipierro
Auch this is a major problem. It is a breakage of backward compatibility due to one of the new functions. Back to work On Oct 29, 5:19 pm, Wes James wrote: > I've been having problems with t3 with 1.69.1 using sqlite and > postgres.  With sqlite I get this when logging in to t3 wiki > > Trac

[web2py:34117] problems with t3 going from 1.68.1 to 1.69.1

2009-10-29 Thread Wes James
I've been having problems with t3 with 1.69.1 using sqlite and postgres. With sqlite I get this when logging in to t3 wiki Traceback (most recent call last): File "gluon/main.py", line 440, in wsgibase session._try_store_on_disk(request, response) File "gluon/globals.py", line 368, in _t

[web2py:34116] Re: Distributed Transactions

2009-10-29 Thread mdipierro
On Oct 29, 4:54 pm, Thadeus Burgess wrote: > So you would have to insert records for each object individually, then call > distributed_transaction_commit. > > dba.customers.insert() > dbb.sales.insert() > > dba.distributed_transaction_commit(dba, dbb) yes > How would you perform a join?

[web2py:34115] Re: bug in export_to_csv

2009-10-29 Thread mr.freeze
This fixes it: def none_exception(value): """ returns a cleaned up value that can be used for csv export: - unicode text is encoded as such - None values are replaced with the given representation (default ) """ print

[web2py:34114] Re: Distributed Transactions

2009-10-29 Thread Thadeus Burgess
So you would have to insert records for each object individually, then call distributed_transaction_commit. dba.customers.insert() dbb.sales.insert() dba.distributed_transaction_commit(dba, dbb) How would you perform a join? dba(dba.customers.id == dbb.sales.id_customer).select() fo

[web2py:34113] Re: bug in export_to_csv

2009-10-29 Thread mr.freeze
I'm pretty sure it's caused by DALRef On Oct 29, 4:52 pm, "mr.freeze" wrote: > Same error.  I'll take a closer look. > > On Oct 29, 4:36 pm, mdipierro wrote: > > > uploading fix, please check > > > On Oct 29, 4:16 pm, "mr.freeze" wrote: > > > > Perhaps because of DALRef? > > > > >>> rows = db(

[web2py:34112] Re: bug in export_to_csv

2009-10-29 Thread mr.freeze
Same error. I'll take a closer look. On Oct 29, 4:36 pm, mdipierro wrote: > uploading fix, please check > > On Oct 29, 4:16 pm, "mr.freeze" wrote: > > > Perhaps because of DALRef? > > > >>> rows = db(db.purchase.id>0).select() > > >>> for row in rows: > > > ...     print row > > ... > > at >

[web2py:34111] Re: Distributed Transactions

2009-10-29 Thread mdipierro
There is a single function. In your case you would call dba.distributed_transaction_commit(dba,dbb) or try: dba.distributed_transaction_commit(dba,dbb) except: session.flash="distributed transaction failed and rolled back" I have not tried this in some time but when I tried worked

[web2py:34110] Distributed Transactions

2009-10-29 Thread Thadeus Burgess
Massimo, Would you mind giving a more in depth example on distributed transactions with postgres? I know web2py supports them, however there is not much information on it. How would you accomplish a join across databases? Is there an api to abstract this? dba = DAL('postgres...') dbb = DAL('post

[web2py:34109] Re: bug in export_to_csv

2009-10-29 Thread mdipierro
uploading fix, please check On Oct 29, 4:16 pm, "mr.freeze" wrote: > Perhaps because of DALRef? > > >>> rows = db(db.purchase.id>0).select() > >>> for row in rows: > > ...     print row > ... > at > 0x02E85AF0>, ' > buyer': 9, 'order_date': datetime.date(2009, 10, 10), 'id': 1, > 'quantity': 1}

[web2py:34108] bug in export_to_csv

2009-10-29 Thread mr.freeze
Perhaps because of DALRef? >>> rows = db(db.purchase.id>0).select() >>> for row in rows: ... print row ... at 0x02E85AF0>, ' buyer': 9, 'order_date': datetime.date(2009, 10, 10), 'id': 1, 'quantity': 1}> at 0x02EFBBF0>, ' buyer': 10, 'order_date': datetime.date(2009, 10, 11), 'id': 2, 'quan

[web2py:34107] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread mdipierro
Can you email me a diff instead? Massimo On Oct 29, 3:42 pm, Jonathan Lundell wrote: > On Oct 29, 2009, at 1:05 PM, mdipierro wrote: > > > ok make you search for all occurrences in applications/example/  and > > gluon/ > > There's preliminary code > here:http://lobitos.net/web2py-patches/gluon

[web2py:34106] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread Jonathan Lundell
On Oct 29, 2009, at 1:05 PM, mdipierro wrote: > ok make you search for all occurrences in applications/example/ and > gluon/ There's preliminary code here: http://lobitos.net/web2py-patches/gluon/validators.py If that looks generally OK, please let me know and I'll complete the patch. The

[web2py:34105] Re: In trunk wsgi app in a web2py action

2009-10-29 Thread mdipierro
Also in trunk, experimental, ability to decorate web2py actions that return strings with third party WSGI middleware. Example: #define or import WSGI Middleware class MiddlewareUpper: def __init__(self,app): self.app = app def __call__(self,environ, start_response): items

[web2py:34104] Re: Dynamically built Form

2009-10-29 Thread Chris S
I must have had a typo because this now works great. (code for anyone else that has this same qustion) --Working Code for item in list: fields.append(Field(item,requires=IS_INT_IN_RANGE (0,100,error_message=('Must be an Int 0 to 100' for item in list2: fields.

[web2py:34103] Re: Dynamically built Form

2009-10-29 Thread Chris S
Oh great thats even cleaner, can I add validators to a form built this way while you're here? On Oct 29, 3:04 pm, mdipierro wrote: > or in one line > > form=SQLFORM.factory(*[Field(item) for item in list]) > > On Oct 29, 2:41 pm, Chris S wrote: > > > That's great, I'm sure I'll find all sorts o

[web2py:34102] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread mdipierro
ok make you search for all occurrences in applications/example/ and gluon/ On Oct 29, 2:46 pm, Jonathan Lundell wrote: > On Oct 29, 2009, at 10:36 AM, mdipierro wrote: > > > > > I hate these kind of changes because they affect syntax highlighing > > and a lot of example pages. Do you feel stron

[web2py:34101] Re: Dynamically built Form

2009-10-29 Thread mdipierro
or in one line form=SQLFORM.factory(*[Field(item) for item in list]) On Oct 29, 2:41 pm, Chris S wrote: > That's great, I'm sure I'll find all sorts of places that's useful now > that I know about it. > Now that I can dynamically build my Fields for my list, I've tried to > go back and put a re

[web2py:34100] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread Jonathan Lundell
On Oct 29, 2009, at 10:36 AM, mdipierro wrote: > > I hate these kind of changes because they affect syntax highlighing > and a lot of example pages. Do you feel strongly about this? Not so strongly. Only that a difference in name suggests a difference in meaning, and when that's not true, it's

[web2py:34099] Re: Dynamically built Form

2009-10-29 Thread Chris S
That's great, I'm sure I'll find all sorts of places that's useful now that I know about it. Now that I can dynamically build my Fields for my list, I've tried to go back and put a requirement on them for validation. You can't use keywords in a list so I'm a little stumped. Is there a suggestion

[web2py:34098] Re: DAL Rows as dictionary?

2009-10-29 Thread mdipierro
I cannot get this right today. Fixed now I think. On Oct 29, 2:18 pm, "mr.freeze" wrote: > svn trunk head. > >         if isinstance(key,str) and key.count('.')==1: >             (table, field) = key.strip('.') > > Throws an error since you're not splitting the key. > > On Oct 29, 2:16 pm, mdipi

[web2py:34097] Re: DAL Rows as dictionary?

2009-10-29 Thread mr.freeze
Looks like you just fixed it. Tested and working both ways now: >>> rows = db(purchase.product==product.id)(purchase.buyer==buyer.id).select() >>> rows.as_dict(key="buyer.id") or >>>rows.as_dict(key=lambda row: row['buyer']['id']) On Oct 29, 2:18 pm, "mr.freeze" wrote: > svn trunk head. > >

[web2py:34096] Re: DAL Rows as dictionary?

2009-10-29 Thread mr.freeze
svn trunk head. if isinstance(key,str) and key.count('.')==1: (table, field) = key.strip('.') Throws an error since you're not splitting the key. On Oct 29, 2:16 pm, mdipierro wrote: > 1.69.2 or 1.70.1 ? > > On Oct 29, 2:13 pm, "mr.freeze" wrote: > > > I think this line (3

[web2py:34095] Re: DAL Rows as dictionary?

2009-10-29 Thread mdipierro
1.69.2 or 1.70.1 ? On Oct 29, 2:13 pm, "mr.freeze" wrote: > I think this line (3149): > (table, field) = key.strip() > > Should be: > (table, field) = key.split(".") > > On Oct 29, 1:56 pm, mdipierro wrote: > > > OK, I merged yours and mine in trunk. > > > On Oct 29, 1:44 pm, "mr.freeze" wrote

[web2py:34094] Re: DAL Rows as dictionary?

2009-10-29 Thread mr.freeze
I think this line (3149): (table, field) = key.strip() Should be: (table, field) = key.split(".") On Oct 29, 1:56 pm, mdipierro wrote: > OK, I merged yours and mine in trunk. > > On Oct 29, 1:44 pm, "mr.freeze" wrote: > > > I am still testing your solution but here is mine in the meantime.  It

[web2py:34093] Re: DAL Rows as dictionary?

2009-10-29 Thread mdipierro
OK, I merged yours and mine in trunk. On Oct 29, 1:44 pm, "mr.freeze" wrote: > I am still testing your solution but here is mine in the meantime.  It > lets you say rows.as_list(key="buyer.id") for joins > >     def as_dict(self, >                 key='id', >                 compact=True, >    

[web2py:34092] Re: DAL Rows as dictionary?

2009-10-29 Thread mr.freeze
sorry, I meant rows.as_dict(key="buyer.id") On Oct 29, 1:44 pm, "mr.freeze" wrote: > I am still testing your solution but here is mine in the meantime.  It > lets you say rows.as_list(key="buyer.id") for joins > >     def as_dict(self, >                 key='id', >                 compact=True,

[web2py:34091] Re: New web2pyslice on Google Wave robot

2009-10-29 Thread mdipierro
now we are On Oct 29, 1:33 pm, Alex Fanjul wrote: > Massimo, we are not here, and we should! > > http://wsgi.org/wsgi/Frameworks > > Alex F > > El 29/10/2009 16:32, mdipierro escribió: > > > WSGI app > > -- > Alejandro Fanjul Fdez. > alex.fan...@gmail.comwww.mhproject.org --~--~-~--~

[web2py:34090] Re: DAL Rows as dictionary?

2009-10-29 Thread mr.freeze
I am still testing your solution but here is mine in the meantime. It lets you say rows.as_list(key="buyer.id") for joins def as_dict(self, key='id', compact=True, storage_to_dict=True, datetime_to_str=True): rows = sel

[web2py:34089] Re: New web2pyslice on Google Wave robot

2009-10-29 Thread Alex Fanjul
Massimo, we are not here, and we should! http://wsgi.org/wsgi/Frameworks Alex F El 29/10/2009 16:32, mdipierro escribió: > WSGI app -- Alejandro Fanjul Fdez. alex.fan...@gmail.com www.mhproject.org --~--~-~--~~~---~--~~ You received this message because you ar

[web2py:34088] Re: changing a table definition.

2009-10-29 Thread mdipierro
here is what happened: 1) you inserted records that had Null values for number 2) you added the attribute notnull=True but those records are still there 3) you ask for a different length (which would require moving data over) before you do the migration run db(db.address.number==None).update(num

[web2py:34087] Re: DAL Rows as dictionary?

2009-10-29 Thread mdipierro
it seems to me if you join as_dict, the key cannot be always a single field. I have a proposed solution in trunk On Oct 29, 12:22 pm, "mr.freeze" wrote: > as_list seems to be recursing properly now.  Same error on as_dict but > I am digging deeper. > > On Oct 29, 12:12 pm, mdipierro wrote: > >

[web2py:34086] changing a table definition.

2009-10-29 Thread annet
In db.py I have the following table definition: db.define_table('address', db.Field(..), db.Field('number',length=6,default='',notnull=True), db.Field(), migrate='address.table') I needed to set the length of the number column to 9 characters: db.define_table('address', d

[web2py:34085] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread mdipierro
I hate these kind of changes because they affect syntax highlighing and a lot of example pages. Do you feel strongly about this? On Oct 29, 12:25 pm, Jonathan Lundell wrote: > On Oct 29, 2009, at 10:14 AM, Jonathan Lundell wrote: > > > > > On Oct 29, 2009, at 9:57 AM, mdipierro wrote: > > >> sen

[web2py:34084] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread Jonathan Lundell
On Oct 29, 2009, at 10:14 AM, Jonathan Lundell wrote: > > On Oct 29, 2009, at 9:57 AM, mdipierro wrote: > >> >> send me a patch > > OK. > > Do you want to strip spaces? White space generally? If so, should > IS_NULL_OR do the same? I see that stripping is there already. Another question: why is

[web2py:34083] Re: DAL Rows as dictionary?

2009-10-29 Thread mr.freeze
as_list seems to be recursing properly now. Same error on as_dict but I am digging deeper. On Oct 29, 12:12 pm, mdipierro wrote: > I actually think i fixed the recursive dictit but it still could use > some testing. > > Massimo > > On Oct 29, 11:58 am, mdipierro wrote: > > > True. The issue wi

[web2py:34082] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread Jonathan Lundell
On Oct 29, 2009, at 9:57 AM, mdipierro wrote: > > send me a patch OK. Do you want to strip spaces? White space generally? If so, should IS_NULL_OR do the same? > > On Oct 29, 11:31 am, Jonathan Lundell wrote: >> On Oct 29, 2009, at 9:23 AM, mdipierro wrote: >> >> >> >>> You can already do t

[web2py:34081] Re: DAL Rows as dictionary?

2009-10-29 Thread mdipierro
I actually think i fixed the recursive dictit but it still could use some testing. Massimo On Oct 29, 11:58 am, mdipierro wrote: > True. The issue with JOIN is not an easy one to fix. > > Can you send me a patch about one or both issues? > > Massimo > > On Oct 29, 11:43 am, "mr.freeze" wrote:

[web2py:34080] Re: DAL Rows as dictionary?

2009-10-29 Thread mdipierro
True. The issue with JOIN is not an easy one to fix. Can you send me a patch about one or both issues? Massimo On Oct 29, 11:43 am, "mr.freeze" wrote: > Also, the as_list function only converts the first level of DALStorage > to dict when storage_to_dict is true.  Both function (as_list,as_dic

[web2py:34079] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread mdipierro
send me a patch On Oct 29, 11:31 am, Jonathan Lundell wrote: > On Oct 29, 2009, at 9:23 AM, mdipierro wrote: > > > > > You can already do that by piping cleanup which would remove unmached > > charatacters or using IS_MATCH() validator. > > CLEANUP obviates the need for any change at all (and it

[web2py:34078] Re: DAL Rows as dictionary?

2009-10-29 Thread mr.freeze
Also, the as_list function only converts the first level of DALStorage to dict when storage_to_dict is true. Both function (as_list,as_dict) should probably recurse through all level right? On Oct 29, 11:27 am, "mr.freeze" wrote: > Works for normal queries but throws a KeyError on id for joins.

[web2py:34077] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread Jonathan Lundell
On Oct 29, 2009, at 9:23 AM, mdipierro wrote: > > You can already do that by piping cleanup which would remove unmached > charatacters or using IS_MATCH() validator. CLEANUP obviates the need for any change at all (and it doesn't really do what I'm suggesting). MATCH might. But the point of th

[web2py:34076] Re: DAL Rows as dictionary?

2009-10-29 Thread mr.freeze
Works for normal queries but throws a KeyError on id for joins. On Oct 29, 10:12 am, mdipierro wrote: > ok, in trunk, take a look. > > On Oct 29, 9:26 am, Renato-ES-Brazil wrote: > > > I agree. > > > On 29 out, 12:19, "mr.freeze" wrote: > > > > I think it is worth adding an as_dict function to

[web2py:34075] Re: Searching

2009-10-29 Thread __Kyo__
It works! Thank you very much. On Oct 29, 11:13 am, mdipierro wrote: > try: > > def index(): >     records = {} >     if request.vars.boton: >         key=request.vars.dato >         for tablename in db.tables: >             table=db[tablename] >             fields=[table[fieldname] for fieldnam

[web2py:34074] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread mdipierro
You can already do that by piping cleanup which would remove unmached charatacters or using IS_MATH() validator. On Oct 29, 11:18 am, Jonathan Lundell wrote: > On Oct 29, 2009, at 9:01 AM, mdipierro wrote: > > > > > I do not disagree. Shall we make is_not_empty strip? > > If it's going to change

[web2py:34073] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread Jonathan Lundell
On Oct 29, 2009, at 9:01 AM, mdipierro wrote: > > I do not disagree. Shall we make is_not_empty strip? If it's going to change, how about (also) an optional argument, defaulting to None, that's a string that counts as empty? I'm thinking of the case in which you put instructions to the user

[web2py:34072] Re: Searching

2009-10-29 Thread mdipierro
try: def index(): records = {} if request.vars.boton: key=request.vars.dato for tablename in db.tables: table=db[tablename] fields=[table[fieldname] for fieldname in table.fields] queries=[field.like('%'+key+'%') for field in fields if f

[web2py:34071] Re: In trunk wsgi app in a web2py action

2009-10-29 Thread mdipierro
ERRATA: Fixed a problem in trunk and here is a better example: # sample test app def test_wsgi_app(environ, start_response): """just a test app""" status = '200 OK' response_headers = [('Content-type','text/plain'),('Content- Length','13')] start_response(status, response_headers)

[web2py:34070] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread Thadeus Burgess
I would think so yes. -Thadeus On Thu, Oct 29, 2009 at 11:01 AM, mdipierro wrote: > > I do not disagree. Shall we make is_not_empty strip? > > On Oct 29, 10:43 am, Thadeus Burgess wrote: > > Ok, I guess I just figured that IS_NOT_EMPTY would check for if the > string > > was blank as well.

[web2py:34069] Re: Searching

2009-10-29 Thread __Kyo__
Hi, i have a problem running this. def index(): records = {} if request.vars.boton: key=request.vars.dato for tablename in db.tables: table=db[tablename] fields=[table[fieldname] for fieldname in table.fields] queries=[field.like('%'+key

[web2py:34068] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread mdipierro
I do not disagree. Shall we make is_not_empty strip? On Oct 29, 10:43 am, Thadeus Burgess wrote: > Ok, I guess I just figured that IS_NOT_EMPTY would check for if the string > was blank as well. > > Thanks for clarifying > > -Thadeus > > On Thu, Oct 29, 2009 at 10:40 AM, mdipierro wrote: > > tu

[web2py:34067] In trunk wsgi app in a web2py action

2009-10-29 Thread mdipierro
This got buried in a previous thread but it is important. In trunk we have and experimental feature: request.wsgi.environ and request.wsgi.start_response this means that you can now call ANY wsgi function from inside a web2py action: def index(): some_wsgi_app(request.wsgi.environ,request.w

[web2py:34066] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread Thadeus Burgess
Ok, I guess I just figured that IS_NOT_EMPTY would check for if the string was blank as well. Thanks for clarifying -Thadeus On Thu, Oct 29, 2009 at 10:40 AM, mdipierro wrote: > tually is CLEANUP() or CLENAUP(regex='.') that does that. > I do not think we agreed to anything el > --~--~---

[web2py:34065] Re: Dynamically built Form

2009-10-29 Thread Jonathan Lundell
On Oct 29, 2009, at 8:36 AM, Chris S wrote: > > lol, well I've been all around that. Thank you so much, works just > fine now. > > Is there a quick 2-min "why that works" or somewhere you could point > me to as to what that * means/does? Apparently I'm missing out on > something important. It'

[web2py:34064] Re: Dynamically built Form

2009-10-29 Thread Thadeus Burgess
http://docs.python.org/tutorial/controlflow.html#tut-unpacking-arguments * is a python reserved keyword that when placed in front of a list or tuple, it means "Unpack this list" ** does the same, but unpacks a dictionary into variables. so if you do something like def afunc(var1, var2, var3, va

[web2py:34063] Re: IS_NOT_EMPTY validator.

2009-10-29 Thread mdipierro
actually is CLEANUP() or CLENAUP(regex='.') that does that. I do not think we agreed to anything else. On Oct 29, 10:35 am, Thadeus Burgess wrote: > I vaguely remember some discussion about this, but should IS_NOT_EMPTY trim > the value? > > The below passes validation, so when spaces are ent

[web2py:34062] Re: Dynamically built Form

2009-10-29 Thread Chris S
lol, well I've been all around that. Thank you so much, works just fine now. Is there a quick 2-min "why that works" or somewhere you could point me to as to what that * means/does? Apparently I'm missing out on something important. On Oct 29, 10:33 am, mdipierro wrote: > form=SQLFORM.factory

[web2py:34061] IS_NOT_EMPTY validator.

2009-10-29 Thread Thadeus Burgess
I vaguely remember some discussion about this, but should IS_NOT_EMPTY trim the value? The below passes validation, so when spaces are entered into the form (or by a robot), it gets inserted into the database. I'm assuming the proper way of using this is using it in conjunction with the CLEANUP v

  1   2   >