[web2py] How to change db servers (same underlying type)?

2013-09-05 Thread MichaelF
My application currently works fine, accessing a MySQL server on host H1 ("H1" is simply a name I've made up for this example.) I now want to start using MySQL on host H2 (hardware different from H1), same username and pwd. Once the tables/structure are created I'll just dump data from the serve

[web2py] Re: session and/or auth-login problems

2012-11-02 Thread MichaelF
The problem turned out to be that I was trying to save the results of Mail.Attachment() in the session, and those results seem to be a dal (if I remember correctly) object w/ connection. On Monday, October 8, 2012 4:19:59 PM UTC-6, MichaelF wrote: > > I've seen this before but I cann

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread MichaelF
Thanks for that. Here's where I'm confused: 1. In your suggested 'else' you say to get the values from the form. Where do I create the form? Do I do it there (as well as in the GET branch)? I'd like to create the form only one time. 2. You say I do a form.process in the GET branch? I

[web2py] Re: Best practice for prepopulating regular form

2012-10-31 Thread MichaelF
her subject'. Now, that said, I could *easily* believe I'm screwing something else up. If that example works on your system, then there's something else I'm doing wrong. Thoughts? On Wednesday, October 31, 2012 5:59:26 PM UTC-6, Jim S wrote: > > form.vars.fieldname =

[web2py] Best practice for prepopulating regular form

2012-10-31 Thread MichaelF
I have a 'regular' form (i.e., FORM, not SQLFORM). I want to prepopulate some of the fields, but I don't know the values to use for them when I first create the form. What's the best practice for populating field 'subject'? Is it using the 'element' function? For example: form = FORM( FIELD

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread MichaelF
. Thanks again. On Wednesday, October 31, 2012 4:04:25 PM UTC-6, Niphlod wrote: > > On Wednesday, October 31, 2012 10:08:41 PM UTC+1, MichaelF wrote: >> >> 1. Re. PS2: Thanks for the info on the public functions. Sorry about not >> attaching a complete app; I thought that r

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread MichaelF
1. Re. PS2: Thanks for the info on the public functions. Sorry about not attaching a complete app; I thought that really wouldn't have been reasonable on my part. Also, it requires db access, etc. I'll try to repro the problem on a smaller scale. 2. Re. PS1: Please forgive my ignorance/incompet

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread MichaelF
function.split('_'))}} {{=form}} {{if request.is_local:}} {{=response.toolbar()}} {{pass}} ??? Thanks in advance. On Wednesday, October 31, 2012 10:29:14 AM UTC-6, Niphlod wrote: > > inspect the session/ folder and clean it. > Then try again with your preferred browser and see if a

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread MichaelF
Any pointers on how I can debug this? Should I insert a debug trace and step through the controller and the view? Should I enable logging and insert various log statements? Thanks. On Monday, October 8, 2012 4:19:59 PM UTC-6, MichaelF wrote: > > I've seen this before but I cann

[web2py] session and/or auth-login problems

2012-10-08 Thread MichaelF
I've seen this before but I cannot remember what's causing it. I have @auth.requires_login() decorating several of my controller functions. I log in first, 'go' to one of those controller functions/pages in my browser, and I get challenged to log in (even though I'm already logged in). I log in

[web2py] Re: "boolean" type in MySQL: CHAR(1) vs TINYINT(1)

2012-10-01 Thread MichaelF
de the web2py environment), then go to the grid, I see that the box is checked. If I uncheck it, that 'takes'. ?? Thanks. On Saturday, September 22, 2012 7:21:07 AM UTC-6, MichaelF wrote: > > Converting to 2.x fixed the problems. > > On Wednesday, September 19, 2012 12:0

Re: [web2py] Looking for multi-select widget that uses two text boxes

2012-09-30 Thread MichaelF
you implement it, please advise how it goes. I might try > switch to that one if you found it easy to use. All the best, David > > > On Tuesday, July 10, 2012 12:10:50 AM UTC+1, MichaelF wrote: >> >> Nothing's wrong with Anthony's answer; I like it. >> >

[web2py] Re: Inconsistent multi-select POST values?

2012-09-28 Thread MichaelF
t; request.vars.a=['value'] but the drawback is that they always do it even > for regular input fields (). If we were to do it we would > have lots more request.vars.a[0] everywhere. > > The web2py solution is a compromise, as many other design decisions are. > > Mas

[web2py] Inconsistent multi-select POST values?

2012-09-28 Thread MichaelF
I have a form with a multi-select. If I choose one value and submit, the value is set in request.vars.xxx as a single integer (e.g., 2). If I choose more than one value and submit I get a list of string values (e.g., ['1', '5']). If I select no values I get None. Expected? Why the inconsistency

[web2py] Re: Rows to Storage conversion available?

2012-09-27 Thread MichaelF
wrote: > > While we can do this. I think you try d > > rows = db().select(cacheable=True) > > rows will lack update_record and delete_record methods but they should be > pickable. Let is know if that works. > > On Thursday, 27 September 2012 21:26:32 UTC-5, MichaelF wrot

[web2py] Rows to Storage conversion available?

2012-09-27 Thread MichaelF
I want to store Rows values in a session variable. I realize I can't store the Rows object directly, so I use rows.to_list(). The problem is that where I used to be able to use attributes on the Rows object (e.g., rows[0].Meet.Name), now I would have to use string keys when I access the list of

[web2py] Re: how to avoid an overhead

2012-09-27 Thread MichaelF
By 'cache' do you mean a session variable (or several)? Wouldn't that work? On Thursday, September 27, 2012 8:00:59 AM UTC-6, Anthony wrote: > > I suppose it depends on whether all the calculations and db accesses are > needed for the processing as well as the initial creation. If not, you > cou

[web2py] Re: Forms - MVC model

2012-09-26 Thread MichaelF
eling and validation. > > Anthony > > On Wednesday, September 26, 2012 1:55:32 PM UTC-4, MichaelF wrote: >> >> I'm still struggling with the lines of control/authority/info-sharing >> between displaying/processing the data/form. (I realize not everyone agrees &

[web2py] Re: Forms - MVC model

2012-09-26 Thread MichaelF
I'm still struggling with the lines of control/authority/info-sharing between displaying/processing the data/form. (I realize not everyone agrees where these lines should be drawn, and even when drawn they're not necessarily "sharp, bright lines.") I like the idea of having the controller simpl

[web2py] Re: Any updates on this problem (boolean for MySQL from CHAR to TINYINT)?

2012-09-22 Thread MichaelF
Converting to 2.x fixes the problem. On Thursday, September 20, 2012 10:16:46 AM UTC-6, MichaelF wrote: > > Sorry for being impatient...any updates on this problem ( > https://groups.google.com/d/topic/web2py/IukqqZF_PPE/discussion) > > The problem is changing the web2py type

[web2py] Re: "boolean" type in MySQL: CHAR(1) vs TINYINT(1)

2012-09-22 Thread MichaelF
Converting to 2.x fixed the problems. On Wednesday, September 19, 2012 12:04:28 PM UTC-6, MichaelF wrote: > > I have come across one bug with this. If I add a record using the admin > interface, I check the 'Is_home_team' checkbox (Is_home_team is defined as > a boolea

[web2py] Any updates on this problem (boolean for MySQL from CHAR to TINYINT)?

2012-09-20 Thread MichaelF
Sorry for being impatient...any updates on this problem (https://groups.google.com/d/topic/web2py/IukqqZF_PPE/discussion) The problem is changing the web2py type of 'boolean' on MySQL from CHAR(1) to TINYINT. It works except for UPDATEs. Thanks. --

[web2py] Re: "boolean" type in MySQL: CHAR(1) vs TINYINT(1)

2012-09-19 Thread MichaelF
d. ?? On Monday, September 17, 2012 9:53:34 PM UTC-6, MichaelF wrote: > > Well, that's unfortunate. I've migrated this semi-manually; I had only > four 'boolean' fields. > > Other than that, the suggested fix ( > db._adapter.types['boolean']='TINY

[web2py] Re: "boolean" type in MySQL: CHAR(1) vs TINYINT(1)

2012-09-17 Thread MichaelF
ierro wrote: > > I cannot reproduce this error with your code in 2.0.9 and the lines in > your traceback do not correspond to the source code I have. I think you may > be using an older dal.py > > On Monday, 17 September 2012 16:43:30 UTC-5, MichaelF wrote: >> >> Ye

[web2py] Re: "boolean" type in MySQL: CHAR(1) vs TINYINT(1)

2012-09-17 Thread MichaelF
default=False), format='%(Pool_name)s %(Nr_lanes)s') Line 165 is the last line of the statement (format=...). On Monday, September 17, 2012 3:15:08 PM UTC-6, Massimo Di Pierro wrote: > > Do you have a traceback with more information? > > On Monday,

[web2py] Re: "boolean" type in MySQL: CHAR(1) vs TINYINT(1)

2012-09-17 Thread MichaelF
t's lower case. I'm confused. Michael On Monday, September 17, 2012 12:51:34 PM UTC-6, Massimo Di Pierro wrote: > > Field('Pending' <<< upper case > ... > 'pending' <<< lower case > > > > On Monday, 17 September 2012 11:37:13

[web2py] Re: "boolean" type in MySQL: CHAR(1) vs TINYINT(1)

2012-09-17 Thread MichaelF
lt = False), ... I get the following error on the line that defines field 'Pending' (and this is the first 'boolean' type in the file): 'pending'I have not changed the underlying MySQL db yet; all the booleans are still char(1). Do I need to change them first t

[web2py] Re: "boolean" type in MySQL: CHAR(1) vs TINYINT(1)

2012-09-17 Thread MichaelF
1. What will I need to import to get it to recognize 'copy'? I run the suggested code and get told that 'copy' does not exist. (I'm running 2.5; what do I conditionally import?) 2. Are we doing a copy because all the adapters share the same 'types' object? On Tuesday, August 7, 2012 3:48:35 PM

[web2py] Using SQL functions in SELECT?

2012-09-16 Thread MichaelF
Is there a way I can use 'arbitrary' SQL functions in my queries? For example, I might want to do something akin to: SELECT * FROM tbl WHERE Start_date < NOW(); I realize that in this particular case I can translate the "NOW()" SQL function to the current date/time. But how about other function

[web2py] Re: Problem accessing Rows/Row

2012-09-14 Thread MichaelF
ticular table, we need the table name. It is out > of necessity rather than following some kind of structured rule. > > Does that make sense? > > > On Friday, September 14, 2012 10:43:04 AM UTC+8, MichaelF wrote: >> >> The problem is that I need to change

[web2py] Re: Problem accessing Rows/Row

2012-09-13 Thread MichaelF
So, if I understand correctly, if my fields come from only one table I leave off the table name when 'addressing' the row, else I do use the table name. That seems 'unorthogonal'. Am I misunderstanding? On Thursday, September 13, 2012 4:16:44 PM UTC-6, MichaelF wrote: > &g

[web2py] Problem accessing Rows/Row

2012-09-13 Thread MichaelF
I do a similar set of steps, yet one of the sets acts differently. I'm trying to loop through a query return (Rows), but I'm obviously missing something basic. I do a query and 'print' the return. Here's a snippet from my controller: line 144: instAttch = db((db.Meet.id == request.args(1)) &

Re: [web2py] fake_migrate options works, but then problem when taken out

2012-09-13 Thread MichaelF
> On Thu, Sep 13, 2012 at 7:20 PM, MichaelF >wrote: > >> I don't know where the lower case is_home_team is coming from. In the >> entire app dir it appears only in the error pages. >> >> The 'migrate = true, fake_migrate = true' yields the same

Re: [web2py] fake_migrate options works, but then problem when taken out

2012-09-13 Thread MichaelF
; What about the case > Is_home_team / is_home_team? > > On Sep 13, 2012 6:37 PM, "MichaelF" > > wrote: > > I have a field ('Is_home_team') that was defined as 'boolean', and I > changed it to 'integer'. The migrate failed (I'm using MySQ

[web2py] fake_migrate options works, but then problem when taken out

2012-09-13 Thread MichaelF
I have a field ('Is_home_team') that was defined as 'boolean', and I changed it to 'integer'. The migrate failed (I'm using MySQL). I then invoked the following on the table def that defines Is_home_team: migrate = False, fake_migrate = True I also altered the underlying MySQL table to change th

Re: [web2py] Many-many options

2012-09-13 Thread MichaelF
the issues : > http://pragprog.com/book/bksqla/sql-antipatterns > > Richard > > On Thu, Sep 13, 2012 at 11:40 AM, MichaelF > > wrote: > >> The P3 record will have text and/or file information that relates to >> several P1 records, or several P2 records, and

Re: [web2py] Many-many options

2012-09-13 Thread MichaelF
ils about the nature of the information to store, it > could be easier to give an answer... > > You can also use the junction table to store weak entity attribute, that > could avoid the P3 table. > > Richard > > On Thu, Sep 13, 2012 at 11:01 AM, MichaelF > > wrote

[web2py] Many-many options

2012-09-13 Thread MichaelF
This might be more of a SQL design question, but if web2py handles one better than another, that would be good to know. Suppose I have three 'parent' records ((P1, P2, and P3), and I want to link P1 records with P3 records, and also P2 records with P3 records. Several options: Option 1: obviou

[web2py] Re: When/how is 'format' used?

2012-09-12 Thread MichaelF
Thanks. I didn't realize that SQLFORM was used by default to display a Row object; that makes sense. And the presence/invocation of those 'format' expressions is what's causing the various 'additional' SELECT statements I see in the "db stats" display, yes. By 'additional' I mean they're SELECT

[web2py] When/how is 'format' used?

2012-09-11 Thread MichaelF
I have the following parent-child: db.define_table('Institution', Field('Institution_name', 'string', length=60, required=True, unique=True), format='%(Institution_name)s') db.define_table('Team', Field('Institution', db.Institut

[web2py] Re: Is 'second option' for one-many available for many-many?

2012-09-11 Thread MichaelF
db.Team.insert(name='snakes') > db.Participant_team.insert(Meet=a,Team=b) > teamStaff = db(db.Meet.id == a).select( > db.Meet.ALL, db.Team.ALL, > join = db.Team.on( > (db.Participant_team.Meet == db.Meet.id) & > (db.Participant_team.Team == db.

[web2py] Re: Is 'second option' for one-many available for many-many?

2012-09-11 Thread MichaelF
Thanks; I think I have it. The SQL is: SELECT Meet.*, Team.* FROM Meet INNER JOIN Participant_team ON Meet.id = Participant_team.Meet INNER JOIN Team ON Participant_team.Team = Team.id; My web2py below implements that. On Tuesday, September 11, 2012 9:25:01 AM UTC-6, MichaelF wrote

[web2py] Re: Is 'second option' for one-many available for many-many?

2012-09-11 Thread MichaelF
join = [db.Participant_team.on( db.Participant_team.Meet == db.Meet.id<http://db.meet.id/> ), db.Team.on(db.Participant_team.Team == db.Team.id<http://db.team.id/> )]) On Tuesday, September 11, 2012 9:04:25 AM UTC-6, MichaelF wrote: > > Section 6.

[web2py] Is 'second option' for one-many available for many-many?

2012-09-11 Thread MichaelF
Section 6.21.1 in the manual talks about an alternative syntax for 1-many joins, using the 'on' function. Is that technique available for many-many? I try this and get an error: # In this example, Meet and Team are being connected through Participant_team teamStaff = db(db.Meet.id == request.ar

[web2py] Re: Trying to reproduce Ex. in manual, sec. 6.21.1 (inner joins)

2012-09-11 Thread MichaelF
t;> >> rows = db(db.person).select(db.person.ALL, db.dog.ALL, left=db.dog.on( >> db.person.id==db.dog.owner)) >> >> Perhaps is should default to select all fields as he book suggests. I >> will look into this. Please open a ticket with a suggestion for enhanceme

[web2py] Trying to reproduce Ex. in manual, sec. 6.21.1 (inner joins)

2012-09-10 Thread MichaelF
I have a db structure similar to the person/dog tables in section "6.21 One to many relation." I try the inner join (second form, from the book): 1 >>> rows = db(db.person).select(join=db.dog.on(db.person.id==db.dog.owner)) 2 >>> for row in rows: 3 print row.person.name, 'has', row.dog.name 4 Al

Re: [web2py] sqlform.grid and query conditions

2012-09-07 Thread MichaelF
x27;,args=id,user_signature=True) > return dict(link=link) > > @auth.requires_signature() > def edit(): > ... > > Now the http://.../edit/?signature= is still the id of the > record but without the signature the URL is not valid. > > > > > > On

Re: [web2py] sqlform.grid and query conditions

2012-09-07 Thread MichaelF
quires_membership and $auth.requires_signature. > > Massimo > > On Friday, 7 September 2012 09:22:12 UTC-5, MichaelF wrote: >> >> I appreciate that web2py has ways to handle this, and I also agree that >> it's somewhat hackish. The problem remains, though, that we&#x

Re: [web2py] sqlform.grid and query conditions

2012-09-07 Thread MichaelF
I appreciate that web2py has ways to handle this, and I also agree that it's somewhat hackish. The problem remains, though, that we're still exposing (publishing) internal primary keys to the browser. Isn't the main problem the fact that we're dealing with primary key values being sent to the b

[web2py] When will "web2py Application Development Cookbook" be updated with grid/smartgrid?

2012-09-06 Thread MichaelF
When will "web2py Application Development Cookbook" be updated with grid/smartgrid? I purchased the book recently and was disappointed to see that neither SQLFORM.grid nor SQLFORM.smartgrid were mentioned. I assume that's because those are still 'beta' or experimental. Any thoughts on when the

[web2py] Nit in manual (= should be ==)?

2012-09-06 Thread MichaelF
Section 7.8 (SQLFORM.grid and smartgrid) in the description of displaying parents and children using grid: SQLFORM.grid(db.parent,left=db.child.on(db.child.parent=db.parent.id)) The second '=' should be '==' yes? --

[web2py] Re: Confused re. "Validators in model not good MVC"

2012-07-23 Thread MichaelF
tuation is not something i 'live with.' It's a great convenience. > > On Monday, July 23, 2012 3:41:39 PM UTC-4, MichaelF wrote: >> >> The documentation says, in section 6.17.4 (my highlighting): >> >> 1 {{extend 'layout.html'}} >>> 2 Re

[web2py] Confused re. "Validators in model not good MVC"

2012-07-23 Thread MichaelF
The documentation says, in section 6.17.4 (my highlighting): 1 {{extend 'layout.html'}} > 2 Records > 3 {{=SQLTABLE(rows)}} > SQLTABLE converts the rows into an HTML table with a header containing the > column names and one row per record. ... The values extracted from the database are also f

[web2py] Documentation nit

2012-07-23 Thread MichaelF
The last sentence of section 6.17 says, "Yes this is unusual and not rarely needed." It should read something like, "Yes this is unusual and rarely needed," or "Yes this is unusual and not often needed." --

[web2py] 'best' way to include a JavaScript file

2012-07-12 Thread MichaelF
I want to include a JavaScript file, but only for certain views. What's the best way to include it? Do I have the controller append it to the response.files property? Do I simply use the

Re: [web2py] Getting drop-down value names from grandparent record

2012-07-11 Thread MichaelF
27;%s' % (db.A[r.A_id].A_name) On Wednesday, July 11, 2012 9:54:24 AM UTC-6, MichaelF wrote: > > Okay; I understand. Let me explain using a simpler version, and also come > up with SQL that would do the equivalent. > > Here's a simpler version. This example shows the p

Re: [web2py] Getting drop-down value names from grandparent record

2012-07-11 Thread MichaelF
I'd like to see in the drop-down. And yet the error I get is: 'B_id' An equivalent SQL to get the A_name for each C id would be: SELECT C.id, A.A_name FROM A INNER JOIN B ON A.id = B.A_id INNER JOIN C ON B.id = C.B_id; Thoughts? Thanks. On Wednesd

Re: [web2py] Getting drop-down value names from grandparent record

2012-07-10 Thread MichaelF
Didn't help. I now get the same error, this time in the function. Any idea what the error message is trying to tell me? On Tuesday, July 10, 2012 12:50:01 AM UTC-6, Johann Spies wrote: > > On 10 July 2012 01:09, MichaelF wrote: > >> >>lambda r: '%s

Re: [web2py] Looking for multi-select widget that uses two text boxes

2012-07-09 Thread MichaelF
> wrong with that suggestion? > > > On Sunday, July 8, 2012 9:00:04 PM UTC+1, MichaelF wrote: >> >> Thanks, Bruno. That's not quite what I need for this job, but I do need >> that in another. I need something more like what Anthony posted ( >> http://quasipa

[web2py] Getting drop-down value names from grandparent record

2012-07-09 Thread MichaelF
In short, I'm having problems getting the drop-down value for a field in a child-of-a-child record; I want that value to be a field from the grandparent. In more detail: 1. I have three 'independent' tables ('independent' in that they have no parents). Let's call them I1, I2, and I3.

[web2py] Any difference passing a string vs. a field for arg #2 in IS_IN_DB?

2012-07-09 Thread MichaelF
The doc shows two calling patterns for IS_IN_DB, the difference being the type of the second positional argument: The example in section 3.6 shows: db.comment.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s') Section 6.5 has a table for default validators: IS_IN_DB(db,table.field,format

Re: [web2py] Looking for multi-select widget that uses two text boxes

2012-07-08 Thread MichaelF
> > Click > here.<http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18> > > > > > On Sun, Jul 8, 2012 at 3:10 PM, MichaelF wrote: > >> I'm aware o

[web2py] Looking for multi-select widget that uses two text boxes

2012-07-08 Thread MichaelF
I'm aware of the multiple and checkbox widgets. I'm looking for a widget whose name I don't know. It consists of two side-by-side boxes, each box can contain a list of items, and usually starts off with all the items in the left-hand box. Between the two boxes are two arrows, usually one on top

[web2py] Re: MySQL migration fails adding unique=

2012-07-05 Thread MichaelF
this in my test environment and > have migrations turned off in production. > > Alternatively, you could update the column def in web2py, change manually > in mysql and then run with migrate=False, fake_migrate=True to get things > back in sync. > > Hope that helps. > > -J

[web2py] MySQL migration fails adding unique=

2012-07-05 Thread MichaelF
I have a working app using web2py `(1, 99, 7, datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable'); Python 2.5.4: C:\Program Files (x86)\web2py\web2py_no_console.exe`) and MySQL 5.5. If I change one field to add `unique=True` the web2py migration fails with this error: `" 'institution_name'"` whe

[web2py] MySQL migration fails adding unique

2012-07-05 Thread MichaelF
I have a working app using web2py `(1, 99, 7, datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable'); Python 2.5.4: C:\Program Files (x86)\web2py\web2py_no_console.exe`) and MySQL 5.5. If I change one field to add `unique=True` the web2py migration fails with this error: `" 'institution_name'"` whe