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
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
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."
--
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
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
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?
--
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
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
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
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
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
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
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
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.
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
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.
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
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
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
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
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
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
; 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
> 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
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)) &
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
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
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
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
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
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
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,
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
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
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.
--
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
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
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
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
&
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
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
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
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
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
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
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
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
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
>
> 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
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
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.
> 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
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
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
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.
>>
>
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
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
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
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
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
.
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
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
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 =
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
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
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
66 matches
Mail list logo