[web2py] Re: SQLFORM weird

2013-06-23 Thread lucas
i figured it out. i should have put writable=False, readable=False as the extra options in the field definition. i did think that was that important and that i could assign a preprocessed value to the field, but obviously not. ok, thanx for everyone help, not a bad little discussion. sorry f

[web2py] Re: SQLFORM weird

2013-06-23 Thread lucas
> > I can't figure out how to help. I mean we have a 'harry' field and now we > have a 'party' variable. It just seems too confusing. > oh jiminy crickets, harry really should be party. i changed things from the original a bit to be less esoteric and i made it worse, sorry. that damn human

[web2py] Re: SQLFORM weird

2013-06-23 Thread villas
Hi Lucas I can't figure out how to help. I mean we have a 'harry' field and now we have a 'party' variable. It just seems too confusing. When I get a situation like this I try to simplify things so they are working and then try to work forward testing each step. Best wishes, D On Monday

[web2py] Re: SQLFORM weird

2013-06-23 Thread Anthony
FYI, you can do: myint = request.args(0, default=0, cast=int, otherwise='http://error_url') The default value is returned if there is no arg at the index specified. If there is an arg, it attempts to use the function provided in cast to convert the arg. If that fails, it redirects to the URL sp

[web2py] Re: How to get the file name when importing a csv file?

2013-06-23 Thread Anthony
Try response.vars.csvfile.filename. Anthony On Sunday, June 23, 2013 4:39:08 PM UTC-4, Dane Wright wrote: > > I'm importing a lot of csv files through Database Administration and would > like to be reminded of which one was last imported. > > I was going to amend appadmin.py so that the response

[web2py] Re: how to show table records through the formats of referenced tables

2013-06-23 Thread Anthony
Another option is to do nothing at all. By default, a reference field gets a default IS_IN_DB validator, and as long as you don't override that default validator, it also gets a default represent attribute based on the format of the referenced field (in fact, that is the exact purpose of the fo

[web2py] Re: SQLFORM weird

2013-06-23 Thread lucas
> > ok, still trying new ideas. this time i stored the prtype in a session > variable then did an onvalid function to pass the session.party value into > gform.vars.party, or: def worksheet2b(): cidi = args_to_int(0) sidi = args_to_int(1) gidi = mcp.request_to_int(request.vars.pr)

[web2py] how to show table records through the formats of referenced tables

2013-06-23 Thread step
Given three tables, bc, b and c: define_table('bc', Field('b'), Field('c'), Field('b_id', 'reference b', writable=False), Field('c_id', 'reference c', writable=False)) define_table('b', Field('x'), Field('y'), format='b drops %(x)s and %(y)s') define_table('c', Field('x'), Field('y'),

[web2py] Re: SQLFORM weird

2013-06-23 Thread villas
However, I must admit, as there isn't a built in function, I find the code more transparent like this... try: myint = int(request.args(0)) except: myint = None or if we are testing whether this is a valid id... myvalidrecord = db.mytable(request.args(0)) If not myvalidrecord: sess

[web2py] Re: SQLFORM weird

2013-06-23 Thread villas
Yes, I thought it would be like that because I often do the same. I always thought something like this should be built into the framework. Thanks, D On Sunday, 23 June 2013 22:38:01 UTC+1, lucas wrote: > > For interest, what are the functions args_to_int() request_to_int() ? >> Those are

[web2py] Re: SQLFORM weird

2013-06-23 Thread lucas
> > For interest, what are the functions args_to_int() request_to_int() ? > Those are your special functions, right? > Just wondering if that is something new; looks useful. > it is just: def args_to_int(argi): try: return mcp.str_to_int(request.args(argi)) except:

[web2py] Re: SQLFORM weird

2013-06-23 Thread lucas
i agree with you under normal conditions. however, i am trying to pass the value of party via a redirect via args or vars and then use it to set gform.vars.party which should transfer that value into the db table. so how come i am having trouble doing that? thanx, lucas -- --- You receive

[web2py] Re: SQLFORM weird

2013-06-23 Thread villas
Hi Lucas For interest, what are the functions args_to_int() request_to_int() ? Those are your special functions, right? Just wondering if that is something new; looks useful. Thanks, D -- --- You received this message because you are subscribed to the Google Groups "web2py-users" gr

[web2py] Re: Ajax auto-populating doesn't work with update form

2013-06-23 Thread Alan Etkin
> > Well, that's pretty impressive... mate. > > ;) > > Thanks a lot. Will surely try it. > I have updated the recipe because it had some details not solved (i.e. the forms do not process the input and widgets without filter with default values). Here's the new version. I plan to post this in we

[web2py] How to get the file name when importing a csv file?

2013-06-23 Thread Dane Wright
I'm importing a lot of csv files through Database Administration and would like to be reminded of which one was last imported. I was going to amend appadmin.py so that the response.flash on line 255 said "data uploaded for "+filename. But I just can't see where the filename is stored. I can see

[web2py] Re: Ajax auto-populating doesn't work with update form

2013-06-23 Thread lesssugar
Well, that's pretty impressive... mate. ;) Thanks a lot. Will surely try it. On Sunday, June 23, 2013 7:53:29 PM UTC+2, Alan Etkin wrote: > > Ahoy there. I have just bought this recipe from a seafaring man with one > leg that might solve this matter. I hope you don't find it fishy: > > model >

[web2py] Re: SQLFORM weird

2013-06-23 Thread Alan Etkin
> > well, supposing that is true. how do i fix it? how do i pass the value > for validation? i thought that is what i was doing by setting it under the > line: > > gform.vars.party = prtype > My bad, prtype must be one of "DEFAULT", "VALUE1" or "VALUE2". You don't really need to validate

[web2py] Re: SQLFORM weird

2013-06-23 Thread lucas
well, supposing that is true. how do i fix it? how do i pass the value for validation? i thought that is what i was doing by setting it under the line: gform.vars.party = prtype -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To un

[web2py] Re: Ajax auto-populating doesn't work with update form

2013-06-23 Thread Alan Etkin
Ahoy there. I have just bought this recipe from a seafaring man with one leg that might solve this matter. I hope you don't find it fishy: model # Pretty close to your model aye? db.define_table("department", Field("name"), format="%(name)s") db.define_table("myrank", Field("name"), Field("depar

[web2py] GAE Database codification issues? Using reveal-slides and wiki pages

2013-06-23 Thread peibol
Hi all! I'm adapting the reveal-slides implementation made by Massimo, by using as input a page from the builtin wiki. Pretty cool! In local, everything runs great, but when running in gae, some issue with the codification in the db made the thing weird. There is even no show of the reveal css..

[web2py] Re: automigration with referenced table and a feature request

2013-06-23 Thread Massimo Di Pierro
On Sunday, 23 June 2013 08:53:26 UTC-5, Dmitri Husti wrote: > > Hi, > I've got the problem I cant change a attribute like notnull at a > referenced column. > Is this a bug or a feature? > This is a bug. We know about it but the problem is that in early versions of web2py we did not save enough

Re: [web2py] websockets

2013-06-23 Thread Ricardo Pedroso
On Fri, Jun 21, 2013 at 6:14 PM, shartha wrote: > Hi Ricardo, > > Thank you very much for posting the application. Here are a few questions > that I have regarding this: > 1. Do I need to put the route.py in the root directory of my app? > 2. I tried by putting the routes.py in the rood directory

[web2py] Re: How to give web2py commandline options when using apache, mod_wsgi

2013-06-23 Thread Niphlod
On Sunday, June 23, 2013 3:31:26 PM UTC+2, Apoorve Mohan wrote: > > Why do i have to run it separately? Ain't there any other method so that i > just specify the number of workers and as my application starts they are > automatically created/started? > > The scheduler process (i.e. an outside-b

[web2py] Re: SQLFORM weird

2013-06-23 Thread Alan Etkin
> > weird thing with updating an SQLFORM. i have a field definition: > I seems that you are customizing the form values after creation. What does prtype evaluates to after the if elif block? If it is None or '' will probably not pass validation. -- --- You received this message because you

[web2py] SQLFORM weird

2013-06-23 Thread lucas
hello one and all, weird thing with updating an SQLFORM. i have a field definition: Field('harry', length=10, requires=IS_IN_SET(('DEFAULT','VALUE1','VALUE2')), default='DEFAULT'), and here is the controller code: def worksheet2b(): cidi = args_to_int(0) sidi = args_to_int(1) g

[web2py] Re: boolean DAL field giving error under 2.5.1

2013-06-23 Thread Anthony
To be clear, in this example, I used update=False because the field is boolean, but the "update" argument is not simply a boolean argument (i.e., it does not mean "update or don't update") -- it can take any value (or callable) appropriate for the type of field. Anthony On Sunday, June 23, 201

[web2py] Re: boolean DAL field giving error under 2.5.1

2013-06-23 Thread Anthony
> > It's hard to keep up with web2py new features. What is exactly, > update=False? True, but that's not a new feature (been there as long as I can remember). The "update" argument sets the value the field should take upon update if no value is specified (much like "default" works for insert

[web2py] Re: boolean DAL field giving error under 2.5.1

2013-06-23 Thread VP
It's hard to keep up with web2py new features. What is exactly, update=False? Thanks. On Saturday, June 22, 2013 3:33:28 PM UTC-5, Anthony wrote: > > Does this work: > > Field('report_motion', 'boolean', default=False, update=False), > > Anthony > > On Saturday, June 22, 2013 4:16:22 PM U

Re: [web2py] Re: Firebird migrations bug

2013-06-23 Thread Alexei Vinidiktov
Thanks, Massimo! It seems to be working now. I'll do some more testing to be sure the problem is gone for real. On Sun, Jun 23, 2013 at 12:16 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > I think it is now fixed but please check it. > > > On Saturday, 22 June 2013 21:45:44 UTC-5

[web2py] automigration with referenced table and a feature request

2013-06-23 Thread Dmitri Husti
Hi, I've got the problem I cant change a attribute like notnull at a referenced column. Is this a bug or a feature? I also want to suggest a new feature. It usually happens I'm forgetting to save. Would it be possible to add a msg like in word. You havent saved yet, do you want to save now. When i

[web2py] Re: How to give web2py commandline options when using apache, mod_wsgi

2013-06-23 Thread Apoorve Mohan
Why do i have to run it separately? Ain't there any other method so that i just specify the number of workers and as my application starts they are automatically created/started? If there is no such thing provided by web2py then I want to know how safe it is to fire threads from web2py applicat

[web2py] Re: Ajax auto-populating doesn't work with update form

2013-06-23 Thread Anthony
Sorry, I still don't see how your code achieves even the behavior you claim is working. For example, this: {{if request.vars.department:}} {{=XML(result)}} {{else:}} will only get executed when reloading the page after form submission, t

[web2py] Re: Ajax auto-populating doesn't work with update form

2013-06-23 Thread lesssugar
Sure. The table I use *department* and *rank* in (and also the one I perform insert/update on): db.define_table('seafarer_experience', Field('user_id', db.auth_user, default=auth.user_id, readable=False, writable=False), Field('department', db.department, label='Department'), Field(

[web2py] Re: finding the difference in same field

2013-06-23 Thread Massimo Di Pierro
rows = db(db.test).select(limitby=(0,2)) rows[1].update_record(t2 = rows[1].t1-rows[0].t1) or if you need it for all records: row0 = db(db.test).select(limitby=(0,1)).first() db(db.test).update(t2 = db.test.t1-row0.t1) On Sunday, 23 June 2013 01:42:30 UTC-5, Tribo Eila wrote: > > Hi, > > Supp

[web2py] finding the difference in same field

2013-06-23 Thread Tribo Eila
Hi, Supposed a model: db.define_table('test', Field('t1', 'integer'), Field('t2', 'integer'), ) How to find the difference in db.test.t1 (ex: db.test.t2(row2) = db.test.t1(row2) - db.test.t1(row1)) and store the result in db.test.t2. What approach should i used? Thanks. -- ---