[web2py] Re: Can't get linkto working in SQLFORM

2012-09-01 Thread david xiao
Hi, 
Not sure if there is anybody else using it or trying it, but I 
encounter this as a start, and hanged there for some time.
In order to help starter going easier, it'd be better to correct it. 
Because SQLFORM class can not be modified, then just to correct the example 
in the book.
I think the simple way is to change in display_form function:
FROM:

 link = URL('list_records', args='db')
 TO:
 link = URL('list_records')

 in list_records, strip the first prefix by dot-delimit:
 like:

query = request.vars.query
  To:
  
query = request.vars.query
query = ..join(query.split(.)[1:]) 

I tried it work.



On Tuesday, July 12, 2011 5:08:09 AM UTC-7, jc wrote:

 Hi,
 Trying to use linkto, so following example in web2py 
 bookhttp://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Records
  first, 
 to try to understand.

 I have copied the example with person and dog tables, in particular in def 
 display_form(): I have

 link = URL('list_records')
 form = SQLFORM(db.person, record, deletable=True,
   upload=url, linkto=link, labels = {'dog.owner':This 
 person's dogs})

 as described in the book.

 The books says the link generated will be 
 /test/default/list_records/dog?query=dog.owner%3D5 but in fact the link 
 which appears when I visit /test/default/display_form/1 is 
  /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1, 
 i.e. there is a spurious list.records and a spurious %3D. Not surprisingly 
 the link doesn't work. Can anybody tell me what I am doing wrong? 

 Thanks.


-- 





[web2py] Re: Can't get linkto working in SQLFORM

2011-07-26 Thread DenesL

That was the point of posting the original text from the book:

the appadmin UPDATE form shows a link
this says appadmin uses it, but then

This behavior can be replicated using the linkto argument of the
SQLFORM
this says you can use too, and gives an example.

Just playing devil's advocate here.


On Jul 26, 1:42 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I am not sure this is something we want to encourage outside appadmin.
 It should be corrected but it should say this is for appadmin.

 On Jul 25, 5:57 pm, Anthony abasta...@gmail.com wrote:







  On Monday, July 25, 2011 5:19:45 PM UTC-4, Massimo Di Pierro wrote:

- Why was this changed?.

   this was changed 2 years ago because the syntax of appadmin changed
   from raw SQL to DAL.

- Does anybody use it this way?.

   nobody. That is why we changed it. The documentation is incorrect.
   Strangely this was changed BEFORE the documentation was published.

  What should the documentation say?

  Anthony


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread jc
Maybe the fix is just remove it from the manual, since the
instructions in the manual don't work.

On Jul 24, 9:40 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 P.S. I would not suggest using this for anything else by appadmin.

 On Jul 24, 3:39 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  The fact is that is how it works but the manual may be incorrect.

  linkto is used for appadmin and appadmin wants to know which od is
  involved in the query,for example

  db.table.field==1

  so linkto has to be of the form URL('action',args='db')

  It has been so for two years. It cannot be changed without breaking
  appadmin.

  Massimo

  On Jul 22, 11:05 am, DenesL denes1...@yahoo.ca wrote:

   Yes, I can reproduce it running web2py 1.97.1 from source on Windows.

link=URL('list_records')
print link

   /test/default/list_records form = SQLFORM(db.person,1,linkto=link)
print form.element('#dog__owner__row')

   tr id=dog__owner__rowtd class=w2p_fl/tdtd class=w2p_fwa
   class=reference href=/test/default/list_records/dog?
   query=list_records.dog.owner%3D%3D1dog.owner/a/tdtd
   class=w2p_fc/td/tr

   sqlhtml.py line 845 does not seem right on getting db:
   db = linkto.split('/')[-1]

   but is seems strange that nobody has complained about it before since
   that has been in place for a few releases back.

   Denes.

   On Jul 21, 1:18 pm, Massimo Di Pierro massimo.dipie...@gmail.com
   wrote:

I cannot reproduce this. Can anybody else?

On Jul 18, 8:13 pm, tcab abu...@gmail.com wrote:

 Ok - added issue 
 ashttp://code.google.com/p/web2py/issues/detail?id=340

 On Jul 15, 9:45 am, Anthony abasta...@gmail.com wrote:

  Please submit an issue on Google 
  Code:http://code.google.com/p/web2py/issues/list

  On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
   I get this too - a spurious list_records. prepended to the 
   query.
   Latest web2py 1.97.1

   -Andy

   On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote:
Hi,
Trying to uselinkto, so following example in web2py book
  http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
   first,
to try to understand.

I have copied the example with person and dog tables, in 
particular in
   def
display_form(): I have

link = URL('list_records')
form = SQLFORM(db.person, record, deletable=True,
                  upload=url,linkto=link, labels = 
{'dog.owner':This
person's dogs})

as described in the book.

The books says the link generated will be
/test/default/list_records/dog?query=dog.owner%3D5 but in 
fact the link

which appears when I visit /test/default/display_form/1 is
 /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1,
   i.e.
there is a spurious list.records and a spurious %3D. Not 
surprisingly the

link doesn't work. Can anybody tell me what I am doing wrong?

Thanks.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread Anthony
I updated the book -- added args='db' to the URL() call. Does that make it 
work?
 
Anthony

On Monday, July 25, 2011 2:28:26 AM UTC-4, jc wrote:

 Maybe the fix is just remove it from the manual, since the 
 instructions in the manual don't work. 

 On Jul 24, 9:40 am, Massimo Di Pierro massimo@gmail.com 
 wrote: 
  P.S. I would not suggest using this for anything else by appadmin. 
  
  On Jul 24, 3:39 am, Massimo Di Pierro massimo@gmail.com 
  wrote: 
  
  
  
  
  
  
  
   The fact is that is how it works but the manual may be incorrect. 
  
   linkto is used for appadmin and appadmin wants to know which od is 
   involved in the query,for example 
  
   db.table.field==1 
  
   so linkto has to be of the form URL('action',args='db') 
  
   It has been so for two years. It cannot be changed without breaking 
   appadmin. 
  
   Massimo 
  
   On Jul 22, 11:05 am, DenesL dene...@yahoo.ca wrote: 
  
Yes, I can reproduce it running web2py 1.97.1 from source on Windows. 

  
 link=URL('list_records') 
 print link 
  
/test/default/list_records form = SQLFORM(db.person,1,linkto=link) 

 print form.element('#dog__owner__row') 
  
tr id=dog__owner__rowtd class=w2p_fl/tdtd 
 class=w2p_fwa 
class=reference href=/test/default/list_records/dog? 
query=list_records.dog.owner%3D%3D1dog.owner/a/tdtd 
class=w2p_fc/td/tr 
  
sqlhtml.py line 845 does not seem right on getting db: 
db = linkto.split('/')[-1] 
  
but is seems strange that nobody has complained about it before since 

that has been in place for a few releases back. 
  
Denes. 
  
On Jul 21, 1:18 pm, Massimo Di Pierro massimo@gmail.com 
wrote: 
  
 I cannot reproduce this. Can anybody else? 
  
 On Jul 18, 8:13 pm, tcab abu...@gmail.com wrote: 
  
  Ok - added issue ashttp://
 code.google.com/p/web2py/issues/detail?id=340 
  
  On Jul 15, 9:45 am, Anthony abas...@gmail.com wrote: 
  
   Please submit an issue on Google Code:
 http://code.google.com/p/web2py/issues/list 
  
   On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote: 
I get this too - a spurious list_records. prepended to the 
 query. 
Latest web2py 1.97.1 
  
-Andy 
  
On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote: 
 Hi, 
 Trying to uselinkto, so following example in web2py book 
   
 http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re... 
first, 
 to try to understand. 
  
 I have copied the example with person and dog tables, in 
 particular in 
def 
 display_form(): I have 
  
 link = URL('list_records') 
 form = SQLFORM(db.person, record, deletable=True, 
   upload=url,linkto=link, labels = 
 {'dog.owner':This 
 person's dogs}) 
  
 as described in the book. 
  
 The books says the link generated will be 
 /test/default/list_records/dog?query=dog.owner%3D5 but in 
 fact the link 
  
 which appears when I visit /test/default/display_form/1 is 
 
  /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1, 
i.e. 
 there is a spurious list.records and a spurious %3D. Not 
 surprisingly the 
  
 link doesn't work. Can anybody tell me what I am doing 
 wrong? 
  
 Thanks.



[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread DenesL
Nope.

 link = URL('list_records', args='db')
 link
'/test/default/list_records/db'

The link for id = 1 will be e.g.:
http://127.0.0.1:8000/test/test/list_records/db/dog?query=db.dog.owner%3D%3D1

where the query part looks better but it still fails:

Traceback (most recent call last):
  File C:\w2p\web2py_1.97.1_src\gluon\restricted.py, line 192, in
restricted
exec ccode in environment
  File C:/w2p/web2py_1.97.1_src/applications/test/controllers/
test.py, line 89, in module
  File C:\w2p\web2py_1.97.1_src\gluon\globals.py, line 137, in
lambda
self._caller = lambda f: f()
  File C:/w2p/web2py_1.97.1_src/applications/test/controllers/
test.py, line 34, in list_records
rr = db(db.dog.id == dogid).select()
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 5394, in select
return self.db._adapter.select(self.query,fields,attributes)
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 1168, in select
sql = self._select(query,fields,attributes)
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 1078, in _select
sql_w = ' WHERE ' + self.expand(query)
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 937, in expand
return expression.op(expression.first, expression.second)
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 886, in EQ
return '(%s = %s)' %
(self.expand(first),self.expand(second,first.type))
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 943, in expand
return self.represent(expression,field_type)
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 1280, in
represent
return str(int(obj))
ValueError: invalid literal for int() with base 10: 'db'



On Jul 25, 10:09 am, Anthony abasta...@gmail.com wrote:
 I updated the book -- added args='db' to the URL() call. Does that make it
 work?

 Anthony







 On Monday, July 25, 2011 2:28:26 AM UTC-4, jc wrote:
  Maybe the fix is just remove it from the manual, since the
  instructions in the manual don't work.

  On Jul 24, 9:40 am, Massimo Di Pierro massimo@gmail.com
  wrote:
   P.S. I would not suggest using this for anything else by appadmin.

   On Jul 24, 3:39 am, Massimo Di Pierro massimo@gmail.com
   wrote:

The fact is that is how it works but the manual may be incorrect.

linkto is used for appadmin and appadmin wants to know which od is
involved in the query,for example

db.table.field==1

so linkto has to be of the form URL('action',args='db')

It has been so for two years. It cannot be changed without breaking
appadmin.

Massimo

On Jul 22, 11:05 am, DenesL dene...@yahoo.ca wrote:

 Yes, I can reproduce it running web2py 1.97.1 from source on Windows.

  link=URL('list_records')
  print link

 /test/default/list_records form = SQLFORM(db.person,1,linkto=link)

  print form.element('#dog__owner__row')

 tr id=dog__owner__rowtd class=w2p_fl/tdtd
  class=w2p_fwa
 class=reference href=/test/default/list_records/dog?
 query=list_records.dog.owner%3D%3D1dog.owner/a/tdtd
 class=w2p_fc/td/tr

 sqlhtml.py line 845 does not seem right on getting db:
 db = linkto.split('/')[-1]

 but is seems strange that nobody has complained about it before since

 that has been in place for a few releases back.

 Denes.

 On Jul 21, 1:18 pm, Massimo Di Pierro massimo@gmail.com
 wrote:

  I cannot reproduce this. Can anybody else?

  On Jul 18, 8:13 pm, tcab abu...@gmail.com wrote:

   Ok - added issue ashttp://
  code.google.com/p/web2py/issues/detail?id=340

   On Jul 15, 9:45 am, Anthony abas...@gmail.com wrote:

Please submit an issue on Google Code:
 http://code.google.com/p/web2py/issues/list

On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
 I get this too - a spurious list_records. prepended to the
  query.
 Latest web2py 1.97.1

 -Andy

 On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote:
  Hi,
  Trying to uselinkto, so following example in web2py book

 http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
 first,
  to try to understand.

  I have copied the example with person and dog tables, in
  particular in
 def
  display_form(): I have

  link = URL('list_records')
  form = SQLFORM(db.person, record, deletable=True,
                    upload=url,linkto=link, labels =
  {'dog.owner':This
  person's dogs})

  as described in the book.

  The books says the link generated will be
  /test/default/list_records/dog?query=dog.owner%3D5 but in
  fact the link

  which appears when I visit /test/default/display_form/1 is

   /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1,
 i.e.
  there is a spurious list.records and a spurious %3D. Not
  surprisingly the

  link doesn't work. Can anybody tell me what I am doing
  wrong?

  Thanks.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread DenesL
The original book had:

quote

When editing an existing person, the appadmin UPDATE form shows a link
to a page that lists the dogs that belong to the person. This behavior
can be replicated using the linkto argument of the SQLFORM. linkto has
to point to the URL of a new action that receives a query string from
the SQLFORM and lists the corresponding records. Here is an example:

def display_form():
   record = db.person(request.args(0)) or redirect(URL('index'))
   url = URL('download')
   link = URL('list_records')
   form = SQLFORM(db.person, records, deletable=True, upload=url,
linkto=link)
   if form.accepts(request.vars, session):
  response.flash = 'form accepted'
   elif form.errors:
  response.flash = 'form has errors'
   return dict(form=form)

/quote

So the questions are:
- Why was this changed?.
- Does anybody use it this way?.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread Massimo Di Pierro
 - Why was this changed?.

this was changed 2 years ago because the syntax of appadmin changed
from raw SQL to DAL.

 - Does anybody use it this way?.

nobody. That is why we changed it. The documentation is incorrect.
Strangely this was changed BEFORE the documentation was published.

On Jul 25, 1:28 pm, DenesL denes1...@yahoo.ca wrote:
 The original book had:

 quote

 When editing an existing person, the appadmin UPDATE form shows a link
 to a page that lists the dogs that belong to the person. This behavior
 can be replicated using the linkto argument of the SQLFORM. linkto has
 to point to the URL of a new action that receives a query string from
 the SQLFORM and lists the corresponding records. Here is an example:

 def display_form():
    record = db.person(request.args(0)) or redirect(URL('index'))
    url = URL('download')
    link = URL('list_records')
    form = SQLFORM(db.person, records, deletable=True, upload=url,
 linkto=link)
    if form.accepts(request.vars, session):
       response.flash = 'form accepted'
    elif form.errors:
       response.flash = 'form has errors'
    return dict(form=form)

 /quote

 So the questions are:
 - Why was this changed?.
 - Does anybody use it this way?.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread Anthony
On Monday, July 25, 2011 5:19:45 PM UTC-4, Massimo Di Pierro wrote: 

  - Why was this changed?. 

 this was changed 2 years ago because the syntax of appadmin changed 
 from raw SQL to DAL. 

  - Does anybody use it this way?. 

 nobody. That is why we changed it. The documentation is incorrect. 
 Strangely this was changed BEFORE the documentation was published.

 
What should the documentation say?
 
Anthony
 


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread Massimo Di Pierro
I am not sure this is something we want to encourage outside appadmin.
It should be corrected but it should say this is for appadmin.

On Jul 25, 5:57 pm, Anthony abasta...@gmail.com wrote:
 On Monday, July 25, 2011 5:19:45 PM UTC-4, Massimo Di Pierro wrote:

   - Why was this changed?.

  this was changed 2 years ago because the syntax of appadmin changed
  from raw SQL to DAL.

   - Does anybody use it this way?.

  nobody. That is why we changed it. The documentation is incorrect.
  Strangely this was changed BEFORE the documentation was published.

 What should the documentation say?

 Anthony


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-24 Thread jc
So that's two on Windows, and my original report was based on Ubuntu
with web2py 1.97.1

On Jul 22, 5:05 pm, DenesL denes1...@yahoo.ca wrote:
 Yes, I can reproduce it running web2py 1.97.1 from source on Windows.

  link=URL('list_records')
  print link

 /test/default/list_records form = SQLFORM(db.person,1,linkto=link)
  print form.element('#dog__owner__row')

 tr id=dog__owner__rowtd class=w2p_fl/tdtd class=w2p_fwa
 class=reference href=/test/default/list_records/dog?
 query=list_records.dog.owner%3D%3D1dog.owner/a/tdtd
 class=w2p_fc/td/tr

 sqlhtml.py line 845 does not seem right on getting db:
 db =linkto.split('/')[-1]

 but is seems strange that nobody has complained about it before since
 that has been in place for a few releases back.

 Denes.

 On Jul 21, 1:18 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  I cannot reproduce this. Can anybody else?

  On Jul 18, 8:13 pm, tcab abu...@gmail.com wrote:

   Ok - added issue ashttp://code.google.com/p/web2py/issues/detail?id=340

   On Jul 15, 9:45 am, Anthony abasta...@gmail.com wrote:

Please submit an issue on Google 
Code:http://code.google.com/p/web2py/issues/list

On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
 I get this too - a spurious list_records. prepended to the query.
 Latest web2py 1.97.1

 -Andy

 On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote:
  Hi,
  Trying to uselinkto, so following example in web2py book
http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
 first,
  to try to understand.

  I have copied the example with person and dog tables, in particular 
  in
 def
  display_form(): I have

  link = URL('list_records')
  form = SQLFORM(db.person, record, deletable=True,
                    upload=url,linkto=link, labels = 
  {'dog.owner':This
  person's dogs})

  as described in the book.

  The books says the link generated will be
  /test/default/list_records/dog?query=dog.owner%3D5 but in fact 
  the link

  which appears when I visit /test/default/display_form/1 is
   /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1,
 i.e.
  there is a spurious list.records and a spurious %3D. Not 
  surprisingly the

  link doesn't work. Can anybody tell me what I am doing wrong?

  Thanks.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-24 Thread Massimo Di Pierro
The fact is that is how it works but the manual may be incorrect.

linkto is used for appadmin and appadmin wants to know which od is
involved in the query,for example

db.table.field==1

so linkto has to be of the form URL('action',args='db')

It has been so for two years. It cannot be changed without breaking
appadmin.

Massimo

On Jul 22, 11:05 am, DenesL denes1...@yahoo.ca wrote:
 Yes, I can reproduce it running web2py 1.97.1 from source on Windows.

  link=URL('list_records')
  print link

 /test/default/list_records form = SQLFORM(db.person,1,linkto=link)
  print form.element('#dog__owner__row')

 tr id=dog__owner__rowtd class=w2p_fl/tdtd class=w2p_fwa
 class=reference href=/test/default/list_records/dog?
 query=list_records.dog.owner%3D%3D1dog.owner/a/tdtd
 class=w2p_fc/td/tr

 sqlhtml.py line 845 does not seem right on getting db:
 db = linkto.split('/')[-1]

 but is seems strange that nobody has complained about it before since
 that has been in place for a few releases back.

 Denes.

 On Jul 21, 1:18 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  I cannot reproduce this. Can anybody else?

  On Jul 18, 8:13 pm, tcab abu...@gmail.com wrote:

   Ok - added issue ashttp://code.google.com/p/web2py/issues/detail?id=340

   On Jul 15, 9:45 am, Anthony abasta...@gmail.com wrote:

Please submit an issue on Google 
Code:http://code.google.com/p/web2py/issues/list

On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
 I get this too - a spurious list_records. prepended to the query.
 Latest web2py 1.97.1

 -Andy

 On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote:
  Hi,
  Trying to uselinkto, so following example in web2py book
http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
 first,
  to try to understand.

  I have copied the example with person and dog tables, in particular 
  in
 def
  display_form(): I have

  link = URL('list_records')
  form = SQLFORM(db.person, record, deletable=True,
                    upload=url,linkto=link, labels = 
  {'dog.owner':This
  person's dogs})

  as described in the book.

  The books says the link generated will be
  /test/default/list_records/dog?query=dog.owner%3D5 but in fact 
  the link

  which appears when I visit /test/default/display_form/1 is
   /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1,
 i.e.
  there is a spurious list.records and a spurious %3D. Not 
  surprisingly the

  link doesn't work. Can anybody tell me what I am doing wrong?

  Thanks.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-24 Thread Massimo Di Pierro
P.S. I would not suggest using this for anything else by appadmin.

On Jul 24, 3:39 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 The fact is that is how it works but the manual may be incorrect.

 linkto is used for appadmin and appadmin wants to know which od is
 involved in the query,for example

 db.table.field==1

 so linkto has to be of the form URL('action',args='db')

 It has been so for two years. It cannot be changed without breaking
 appadmin.

 Massimo

 On Jul 22, 11:05 am, DenesL denes1...@yahoo.ca wrote:







  Yes, I can reproduce it running web2py 1.97.1 from source on Windows.

   link=URL('list_records')
   print link

  /test/default/list_records form = SQLFORM(db.person,1,linkto=link)
   print form.element('#dog__owner__row')

  tr id=dog__owner__rowtd class=w2p_fl/tdtd class=w2p_fwa
  class=reference href=/test/default/list_records/dog?
  query=list_records.dog.owner%3D%3D1dog.owner/a/tdtd
  class=w2p_fc/td/tr

  sqlhtml.py line 845 does not seem right on getting db:
  db = linkto.split('/')[-1]

  but is seems strange that nobody has complained about it before since
  that has been in place for a few releases back.

  Denes.

  On Jul 21, 1:18 pm, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   I cannot reproduce this. Can anybody else?

   On Jul 18, 8:13 pm, tcab abu...@gmail.com wrote:

Ok - added issue ashttp://code.google.com/p/web2py/issues/detail?id=340

On Jul 15, 9:45 am, Anthony abasta...@gmail.com wrote:

 Please submit an issue on Google 
 Code:http://code.google.com/p/web2py/issues/list

 On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
  I get this too - a spurious list_records. prepended to the query.
  Latest web2py 1.97.1

  -Andy

  On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote:
   Hi,
   Trying to uselinkto, so following example in web2py book
 http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
  first,
   to try to understand.

   I have copied the example with person and dog tables, in 
   particular in
  def
   display_form(): I have

   link = URL('list_records')
   form = SQLFORM(db.person, record, deletable=True,
                     upload=url,linkto=link, labels = 
   {'dog.owner':This
   person's dogs})

   as described in the book.

   The books says the link generated will be
   /test/default/list_records/dog?query=dog.owner%3D5 but in fact 
   the link

   which appears when I visit /test/default/display_form/1 is
    /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1,
  i.e.
   there is a spurious list.records and a spurious %3D. Not 
   surprisingly the

   link doesn't work. Can anybody tell me what I am doing wrong?

   Thanks.


Re: [web2py] Re: Can't get linkto working in SQLFORM

2011-07-24 Thread Bruno Rocha
I always use virtual fields for links.

http://zerp.ly/rochacbruno
Em 24/07/2011 05:40, Massimo Di Pierro massimo.dipie...@gmail.com
escreveu:
 P.S. I would not suggest using this for anything else by appadmin.

 On Jul 24, 3:39 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:
 The fact is that is how it works but the manual may be incorrect.

 linkto is used for appadmin and appadmin wants to know which od is
 involved in the query,for example

 db.table.field==1

 so linkto has to be of the form URL('action',args='db')

 It has been so for two years. It cannot be changed without breaking
 appadmin.

 Massimo

 On Jul 22, 11:05 am, DenesL denes1...@yahoo.ca wrote:







  Yes, I can reproduce it running web2py 1.97.1 from source on Windows.

   link=URL('list_records')
   print link

  /test/default/list_records form = SQLFORM(db.person,1,linkto=link)
   print form.element('#dog__owner__row')

  tr id=dog__owner__rowtd class=w2p_fl/tdtd class=w2p_fwa
  class=reference href=/test/default/list_records/dog?
  query=list_records.dog.owner%3D%3D1dog.owner/a/tdtd
  class=w2p_fc/td/tr

  sqlhtml.py line 845 does not seem right on getting db:
  db = linkto.split('/')[-1]

  but is seems strange that nobody has complained about it before since
  that has been in place for a few releases back.

  Denes.

  On Jul 21, 1:18 pm, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   I cannot reproduce this. Can anybody else?

   On Jul 18, 8:13 pm, tcab abu...@gmail.com wrote:

Ok - added issue ashttp://
code.google.com/p/web2py/issues/detail?id=340

On Jul 15, 9:45 am, Anthony abasta...@gmail.com wrote:

 Please submit an issue on Google Code:
http://code.google.com/p/web2py/issues/list

 On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
  I get this too - a spurious list_records. prepended to the
query.
  Latest web2py 1.97.1

  -Andy

  On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote:
   Hi,
   Trying to uselinkto, so following example in web2py book
 
http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
  first,
   to try to understand.

   I have copied the example with person and dog tables, in
particular in
  def
   display_form(): I have

   link = URL('list_records')
   form = SQLFORM(db.person, record, deletable=True,
 upload=url,linkto=link, labels =
{'dog.owner':This
   person's dogs})

   as described in the book.

   The books says the link generated will be
   /test/default/list_records/dog?query=dog.owner%3D5 but in
fact the link

   which appears when I visit /test/default/display_form/1 is
  
 /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1,
  i.e.
   there is a spurious list.records and a spurious %3D. Not
surprisingly the

   link doesn't work. Can anybody tell me what I am doing wrong?

   Thanks.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-22 Thread DenesL

Yes, I can reproduce it running web2py 1.97.1 from source on Windows.

 link=URL('list_records')
 print link
/test/default/list_records
 form = SQLFORM(db.person,1,linkto=link)
 print form.element('#dog__owner__row')
tr id=dog__owner__rowtd class=w2p_fl/tdtd class=w2p_fwa
class=reference href=/test/default/list_records/dog?
query=list_records.dog.owner%3D%3D1dog.owner/a/tdtd
class=w2p_fc/td/tr

sqlhtml.py line 845 does not seem right on getting db:
db = linkto.split('/')[-1]

but is seems strange that nobody has complained about it before since
that has been in place for a few releases back.

Denes.


On Jul 21, 1:18 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I cannot reproduce this. Can anybody else?

 On Jul 18, 8:13 pm, tcab abu...@gmail.com wrote:







  Ok - added issue ashttp://code.google.com/p/web2py/issues/detail?id=340

  On Jul 15, 9:45 am, Anthony abasta...@gmail.com wrote:

   Please submit an issue on Google 
   Code:http://code.google.com/p/web2py/issues/list

   On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
I get this too - a spurious list_records. prepended to the query.
Latest web2py 1.97.1

-Andy

On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote:
 Hi,
 Trying to uselinkto, so following example in web2py book
   http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
first,
 to try to understand.

 I have copied the example with person and dog tables, in particular in
def
 display_form(): I have

 link = URL('list_records')
 form = SQLFORM(db.person, record, deletable=True,
                   upload=url,linkto=link, labels = {'dog.owner':This
 person's dogs})

 as described in the book.

 The books says the link generated will be
 /test/default/list_records/dog?query=dog.owner%3D5 but in fact the 
 link

 which appears when I visit /test/default/display_form/1 is
  /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1,
i.e.
 there is a spurious list.records and a spurious %3D. Not surprisingly 
 the

 link doesn't work. Can anybody tell me what I am doing wrong?

 Thanks.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-21 Thread Massimo Di Pierro
I cannot reproduce this. Can anybody else?

On Jul 18, 8:13 pm, tcab abu...@gmail.com wrote:
 Ok - added issue ashttp://code.google.com/p/web2py/issues/detail?id=340

 On Jul 15, 9:45 am, Anthony abasta...@gmail.com wrote:







  Please submit an issue on Google 
  Code:http://code.google.com/p/web2py/issues/list

  On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
   I get this too - a spurious list_records. prepended to the query.
   Latest web2py 1.97.1

   -Andy

   On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote:
Hi,
Trying to uselinkto, so following example in web2py book
  http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
   first,
to try to understand.

I have copied the example with person and dog tables, in particular in
   def
display_form(): I have

link = URL('list_records')
form = SQLFORM(db.person, record, deletable=True,
                  upload=url,linkto=link, labels = {'dog.owner':This
person's dogs})

as described in the book.

The books says the link generated will be
/test/default/list_records/dog?query=dog.owner%3D5 but in fact the 
link

which appears when I visit /test/default/display_form/1 is
 /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1,
   i.e.
there is a spurious list.records and a spurious %3D. Not surprisingly 
the

link doesn't work. Can anybody tell me what I am doing wrong?

Thanks.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-18 Thread tcab
Ok - added issue as http://code.google.com/p/web2py/issues/detail?id=340

On Jul 15, 9:45 am, Anthony abasta...@gmail.com wrote:
 Please submit an issue on Google 
 Code:http://code.google.com/p/web2py/issues/list







 On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
  I get this too - a spurious list_records. prepended to the query.
  Latest web2py 1.97.1

  -Andy

  On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote:
   Hi,
   Trying to use linkto, so following example in web2py book
 http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
  first,
   to try to understand.

   I have copied the example with person and dog tables, in particular in
  def
   display_form(): I have

   link = URL('list_records')
   form = SQLFORM(db.person, record, deletable=True,
                     upload=url, linkto=link, labels = {'dog.owner':This
   person's dogs})

   as described in the book.

   The books says the link generated will be
   /test/default/list_records/dog?query=dog.owner%3D5 but in fact the link

   which appears when I visit /test/default/display_form/1 is
    /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1,
  i.e.
   there is a spurious list.records and a spurious %3D. Not surprisingly the

   link doesn't work. Can anybody tell me what I am doing wrong?

   Thanks.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-15 Thread Anthony
Please submit an issue on Google Code: 
http://code.google.com/p/web2py/issues/list

On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:

 I get this too - a spurious list_records. prepended to the query. 
 Latest web2py 1.97.1 

 -Andy 

 On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote: 
  Hi, 
  Trying to use linkto, so following example in web2py book
 http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re... 
 first, 
  to try to understand. 
  
  I have copied the example with person and dog tables, in particular in 
 def 
  display_form(): I have 
  
  link = URL('list_records') 
  form = SQLFORM(db.person, record, deletable=True, 
upload=url, linkto=link, labels = {'dog.owner':This 
  person's dogs}) 
  
  as described in the book. 
  
  The books says the link generated will be 
  /test/default/list_records/dog?query=dog.owner%3D5 but in fact the link 

  which appears when I visit /test/default/display_form/1 is 
   /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1, 
 i.e. 
  there is a spurious list.records and a spurious %3D. Not surprisingly the 

  link doesn't work. Can anybody tell me what I am doing wrong? 
  
  Thanks.



[web2py] Re: Can't get linkto working in SQLFORM

2011-07-14 Thread tcab
I've been working through the book and have encountered exactly the
same problem.
The query has a spurious 'list_records' in front of it.

book is http://www.web2py.com/book/default/chapter/07?search=URL
web2py version is the latest 1.97.1
running under windows 7

-Andy

On Jul 12, 10:08 pm, jc j-cl...@lineone.net wrote:
 Hi,
 Trying to use linkto, so following example in web2py 
 bookhttp://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
  first,
 to try to understand.

 I have copied the example with person and dog tables, in particular in def
 display_form(): I have

 link = URL('list_records')
 form = SQLFORM(db.person, record, deletable=True,
                   upload=url, linkto=link, labels = {'dog.owner':This
 person's dogs})

 as described in the book.

 The books says the link generated will be
 /test/default/list_records/dog?query=dog.owner%3D5 but in fact the link
 which appears when I visit /test/default/display_form/1 is
  /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1, i.e.
 there is a spurious list.records and a spurious %3D. Not surprisingly the
 link doesn't work. Can anybody tell me what I am doing wrong?

 Thanks.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-14 Thread tcab
I get this too - a spurious list_records. prepended to the query.
Latest web2py 1.97.1

-Andy

On Jul 12, 10:08 pm, jc j-cl...@lineone.net wrote:
 Hi,
 Trying to use linkto, so following example in web2py 
 bookhttp://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...
  first,
 to try to understand.

 I have copied the example with person and dog tables, in particular in def
 display_form(): I have

 link = URL('list_records')
 form = SQLFORM(db.person, record, deletable=True,
                   upload=url, linkto=link, labels = {'dog.owner':This
 person's dogs})

 as described in the book.

 The books says the link generated will be
 /test/default/list_records/dog?query=dog.owner%3D5 but in fact the link
 which appears when I visit /test/default/display_form/1 is
  /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1, i.e.
 there is a spurious list.records and a spurious %3D. Not surprisingly the
 link doesn't work. Can anybody tell me what I am doing wrong?

 Thanks.