[web2py:34022] with_alias() name restrictions

2009-10-29 Thread Richard
Hello, I have a table that links to multiple "media" tables so I use with_alias(). I found that the following causes an error: model = db.media.with_alias('model') but this works: model = db.media.with_alias('model_z') I do have a "model" table so they must be conflicting. What restrictions d

[web2py:34023] New web2pyslice on Google Wave robot

2009-10-29 Thread hcvst
http://www.web2pyslices.com/main/slices/take_slice/17 Still work in progress, but testing locally seems to work. HC --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send e

[web2py:34024] Re: w2p as wsgi middleware

2009-10-29 Thread hcvst
http://www.web2pyslices.com/main/slices/take_slice/17 On 28 Okt., 19:47, mdipierro wrote: > cool! would you make a pyslice? > > On Oct 28, 12:20 pm, hcvst wrote: > > > Rough and dirty - but works for capabilities.xml already. It's odd > > that google's start_response returns a write method - at

[web2py:34025] A html helpers "title" attribute

2009-10-29 Thread Doxaliber
If I write something like this on my index view I got an error: - response.write(A(row.autori.nome_autore.title(), _href=URL(r=request, f="autore", args=row.autori.id) _title="visualizza autori")) ^ SyntaxError: invalid syntax -

[web2py:34026] Re: A html helpers "title" attribute

2009-10-29 Thread Mladen Milankovic
Hi. Your missing a comma before the _title attribute. regards mmlado On Thursday 29 October 2009 11:26:01 Doxaliber wrote: > response.write(A(row.autori.nome_autore.title(), _href=URL(r=request, > f="autore", args=row.autori.id) _title="visualizza autori")) > > ^ > SyntaxError: invalid syntax

[web2py:34027] Re: Http Error 500

2009-10-29 Thread Felipe
This is the messege that I receive from the fault event on the remote object ... (mx.messaging.messages::ErrorMessage)#0 body = (Object)#1 clientId = (null) correlationId = "A1177FFF-9229-469A-DEB1-9FDB5D961B5D" destination = "" extendedData = (null) faultCode = "Client.Error.MessageS

[web2py:34028] web2py data structure

2009-10-29 Thread dbb
I have the following data structure, what I want is the following: if the data entered is not in the database to enter it, then redirect to student information to enter the new data for the student. Once the data is in, the next time I enter the same data,the program compares the student ID in the

[web2py:34029] Hierarchy

2009-10-29 Thread dbb
Hello I have encountered the following problem: Given: adefine_table(x) and define_table(y) ;if table y is below table x in the database, table y can reference table x, but table x can not reference table y --~--~-~--~~~---~--~~ You received this message because

[web2py:34030] Re: +new class and functions

2009-10-29 Thread haftish21
thanks mdipierro: my interest is to put my codes under one folder and call them from the model on an instance of SQLDB object (just like web2py's create_table). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2

[web2py:34031] crud.settings.auth=auth

2009-10-29 Thread dbb
if crud.settings.auth=auth, then 404 not found error when insert and other crud functions are use, if #crud.settings.auth=auth the error no longer shows --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" g

[web2py:34032] Re: A html helpers "title" attribute

2009-10-29 Thread salingrosso
Thank you Mladen, I couldn't figure out where the error was. :-/ This is the result of inexperience with web2py.. :-P 2009/10/29 Mladen Milankovic > > Hi. > > Your missing a comma before the _title attribute. > > regards > mmlado > > On Thursday 29 October 2009 11:26:01 Doxaliber wrote: > > resp

[web2py:34033] Re: RSS service problem

2009-10-29 Thread selecta
awesome now it works, I had to wrap some vars with str() and booom @service.rss def showLatest(): shopnames = db().select(db.shopname.ALL,limitby=(0,20)) return dict( title=str(response.title), link=URL(request.application,'default','call',args= ['rss','showLatest'

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

2009-10-29 Thread mr.freeze
Nice! On Oct 29, 3:11 am, hcvst wrote: > http://www.web2pyslices.com/main/slices/take_slice/17 > > Still work in progress, but testing locally seems to work. > > HC --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "w

[web2py:34035] Re: plugin system again

2009-10-29 Thread Alex Fanjul
This book shows how drupal modules works in detail... http://mhproject.org/media/users/aleksdj/Learning.Drupal.6.Module.Development.May.2008.pdf Alex F El 29/10/2009 5:46, mdipierro escribió: > I agree. Can you help me find such articles? > > for now a plugin is just any subset of an app with a

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

2009-10-29 Thread Alex Fanjul
Could you tell me some example of what is a wave robot for? Is it the same as a typical gtalk translator robot (en...@bot.talk.google.com) where you can send a word and he replay with traslation? or it is more advanced? thanks alex f El 29/10/2009 9:11, hcvst escribió: > http://www.web2pyslic

[web2py:34037] Re: plugin system again

2009-10-29 Thread Alex Fanjul
More on drupal modules development: http://drupal.org/developing/modules El 29/10/2009 5:46, mdipierro escribió: > I agree. Can you help me find such articles? > > for now a plugin is just any subset of an app with a naming > convention. This is just a place where to put something more > structur

[web2py:34038] Re: web2py data structure

2009-10-29 Thread dbb
In all cases the code can not find the data in the database even if it exists; the redirect is not executed; also may be the request.args(0) logic is wrong. Any help on this, those experienced web2py users On Oct 29, 7:03 am, dbb wrote: > I have the following data structure, what I want is the

[web2py:34039] Re: crud.settings.auth=auth

2009-10-29 Thread dbb
while this happens no decoration of security is used for any function in the controller On Oct 29, 7:14 am, dbb wrote: > if crud.settings.auth=auth, then 404 not found error when insert and > other crud functions are use, if #crud.settings.auth=auth the error no > longer shows --~--~-~--

[web2py:34040] Re: with_alias() name restrictions

2009-10-29 Thread mdipierro
The alias translates literally into AS in SQL, therefore it cannot be an existing table, a field or a reserved database keyword. On Oct 29, 2:21 am, Richard wrote: > Hello, > > I have a table that links to multiple "media" tables so I use > with_alias(). > > I found that the following causes an

[web2py:34041] Re: w2p as wsgi middleware

2009-10-29 Thread mdipierro
We should think of a way to expose a standard environment,start_response to web2py action so that they can call wsgi apps directly. On Oct 29, 3:36 am, hcvst wrote: > http://www.web2pyslices.com/main/slices/take_slice/17 > > On 28 Okt., 19:47, mdipierro wrote: > > > cool! would you make a pysli

[web2py:34042] Re: Http Error 500

2009-10-29 Thread mdipierro
Perahps you need to upgrade web2py. You may be using a buggy version. For sure the old wegiserver had a bug related to timeout. On Oct 27, 5:33 am, Felipe wrote: > Dont know... because in my wsgiserver.py there is no such line ... > > and yes, I can browse the site without flex > > On 26 out, 13

[web2py:34043] Re: Hierarchy

2009-10-29 Thread DenesL
Hi dbb, yes you can, instead of Field('x1', db.y) use Fields('x1','reference y') it also works on self-references. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, sen

[web2py:34044] Re: Hierarchy

2009-10-29 Thread mdipierro
There is a way around but the reason we do not try to make this easy is because this is usually a symptom for a different problems. Instead of having two tables that reference each other probably you need a many to many relationship that should be implemented using a link table. Can you tell us mo

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

2009-10-29 Thread Fran
On Oct 29, 4:49 am, mdipierro wrote: > actually I also need this often. I normally do > item_dict=dict([*r.id,r) for r in db(db.items.id > 0).select()]) > or > item_dict=dict([*r.id,r) for r in db(db.items.id > 0).select().as_list > ()]) Looks nice - but there's a typo & I can't quite get the co

[web2py:34046] Re: web2py data structure

2009-10-29 Thread mdipierro
there are meny problems here. 1) in index you do insert after redirect so the insert is never executed 2) you use new_student instead of rquest.vars.new_student 3) you access form.vars in action where it is not defined (after redirect) 4) you denormalize the student name in student_information (so

[web2py:34047] Re: crud.settings.auth=auth

2009-10-29 Thread mdipierro
This the intend behavior. If you want to enforce authentication on crud, you will not be allowed to access actions that do crud on a table unless you have specifically registered a permission for the user 'insert' in that table and you must be logged in. On Oct 29, 6:14 am, dbb wrote: > if crud.

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

2009-10-29 Thread mdipierro
oops.there should be no sterisk. item_dict=dict([(r.id,r) for r in db(db.items.id > 0).select()]) On Oct 29, 8:30 am, Fran wrote: > On Oct 29, 4:49 am, mdipierro wrote: > > > actually I also need this often. I normally do > > item_dict=dict([*r.id,r) for r in db(db.items.id > 0).select()]) >

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

2009-10-29 Thread Fran
On Oct 29, 1:52 pm, mdipierro wrote: > oops.there should be no sterisk. > item_dict=dict([(r.id,r) for r in db(db.items.id > 0).select()]) Great, that works ;) This one still fails: item_dict=dict([(r.id,r) for r in db(db.items.id > 0).select().as_list ()]) 'dict' object has no attribute 'id'

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

2009-10-29 Thread mdipierro
My bad again item_dict=dict([(r['id'],r) for r in db(db.items.id > 0).select ().as_list()]) On Oct 29, 8:58 am, Fran wrote: > On Oct 29, 1:52 pm, mdipierro wrote: > > > oops.there should be no sterisk. > > item_dict=dict([(r.id,r) for r in db(db.items.id > 0).select()]) > > Great, that works ;

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

2009-10-29 Thread mr.freeze
I think it is worth adding an as_dict function to Rows personally. On Oct 29, 9:01 am, mdipierro wrote: > My bad again > > item_dict=dict([(r['id'],r) for r in db(db.items.id > 0).select > ().as_list()]) > > On Oct 29, 8:58 am, Fran wrote: > > > On Oct 29, 1:52 pm, mdipierro wrote: > > > > oop

[web2py:34052] Re: crud.settings.auth=auth

2009-10-29 Thread dbb
Thanks Massimo On Oct 29, 9:51 am, mdipierro wrote: > This the intend behavior. If you want to enforce authentication on > crud, you will not be allowed to access actions that do crud on a > table unless you have specifically registered a permission for the > user 'insert' in that table and you

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

2009-10-29 Thread Renato-ES-Brazil
I agree. On 29 out, 12:19, "mr.freeze" wrote: > I think it is worth adding an as_dict function to Rows personally. > > On Oct 29, 9:01 am, mdipierro wrote: > > > My bad again > > > item_dict=dict([(r['id'],r) for r in db(db.items.id > 0).select > > ().as_list()]) > > > On Oct 29, 8:58 am, Fran

[web2py:34054] Re: Hierarchy

2009-10-29 Thread dbb
I sent you the actual data On Oct 29, 9:29 am, mdipierro wrote: > There is a way around but the reason we do not try to make this easy > is because this is usually a symptom for a different problems. Instead > of having two tables that reference each other probably you need a > many to many rela

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

2009-10-29 Thread mdipierro
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 Rows personally. > > > On Oct 29, 9:01 am, mdipierro wrote: > > > > My bad again > > > > item_dict=dict([(r['id'],r

[web2py:34056] Re: Hierarchy

2009-10-29 Thread mdipierro
It workd for self references but not if y is yet to be defined. On Oct 29, 8:29 am, DenesL wrote: > Hi dbb, > > yes you can, instead of > > Field('x1', db.y) > > use > > Fields('x1','reference y') > > it also works on self-references. --~--~-~--~~~---~--~~ You rec

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

2009-10-29 Thread Thadeus Burgess
I think a "robot" is referring to their API to talk with Google Wave. -Thadeus On Thu, Oct 29, 2009 at 8:00 AM, Alex Fanjul wrote: > > Could you tell me some example of what is a wave robot for? Is it the > same as a typical gtalk translator robot (en...@bot.talk.google.com) > where you can

[web2py:34058] Dynamically built Form

2009-10-29 Thread Chris S
I've been trying to get a form built where the number of Fields are dynamic. I was successful with the plan form by using: Form Implementation fields=[] for item in list: fields.append(item) fields.append(INPUT(_name=item,requires=IS_INT_IN_RANG

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

2009-10-29 Thread mdipierro
I made some changes in trunk that allows you access wsgi directly, based on your code.Instead of # Web2py function def process(): def start_response(status, headers, exc_info=None): http_code, _ = status.split(' ',1) if http_code == '200': for k,v in headers:

[web2py:34060] Re: Dynamically built Form

2009-10-29 Thread mdipierro
form=SQLFORM.factory(*[fields[num] for num in range(len(fields))]) On Oct 29, 10:25 am, Chris S wrote: > I've been trying to get a form built where the number of Fields are > dynamic.  I was successful with the plan form by using: > Form Implementation > field

[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

[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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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

  1   2   >