[web2py] Re: sqlhtml.py - breadcrumbs exception when using smartgrid format + lambda

2012-02-16 Thread Roderick
Hi Massimo and Anthony

Created the following issue:
http://code.google.com/p/web2py/issues/detail?id=663

Unfortunately the fix doesn't work on the breadcrumbs - still getting
the index - although it does work on row data...

Thanks  regards,

Roderick

On Feb 14, 4:44 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Thanks fixed in trunk now.

 On Feb 14, 6:18 am, Roderick roderick.m...@gmail.com wrote:







  Being a noob at Python and Web2py, this is the best I could come up with:

  In sqlhtml.py, insert the 2nd try block (below name = db[referee]._format
  % record) as follows:

                      try:
                          name = db[referee]._format % record
                      except TypeError:
                          try:
                              name = db[referee]._format(record)
                          except TypeError:
                              name = id

  This seems to work for format=%(name)s and format=lambda record:
  record.name formats.

  If anyone has a better/cleaner solution I'd like to hear it..

  Thanks!


[web2py] Re: sqlhtml.py - breadcrumbs exception when using smartgrid format + lambda

2012-02-16 Thread Cliff
Here's an alternative breadcrumb generator that handles object names
like this...

if len(request.args)  0: # tune this value.  grid  smartgrid use
longer arg lists
  if 'name' in db[request.controller].fields:
  item_name = 'editing ' + db[request.controller][args[-1]]].name
  else:
  item_name = 'editing item #' + request.args[-1]

bc_list.append(A(item_name, _href=URL())) #


On Feb 16, 4:26 am, Roderick roderick.m...@gmail.com wrote:
 Hi Massimo and Anthony

 Created the following 
 issue:http://code.google.com/p/web2py/issues/detail?id=663

 Unfortunately the fix doesn't work on the breadcrumbs - still getting
 the index - although it does work on row data...

 Thanks  regards,

 Roderick

 On Feb 14, 4:44 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  Thanks fixed in trunk now.

  On Feb 14, 6:18 am, Roderick roderick.m...@gmail.com wrote:

   Being a noob at Python and Web2py, this is the best I could come up with:

   In sqlhtml.py, insert the 2nd try block (below name = db[referee]._format
   % record) as follows:

                       try:
                           name = db[referee]._format % record
                       except TypeError:
                           try:
                               name = db[referee]._format(record)
                           except TypeError:
                               name = id

   This seems to work for format=%(name)s and format=lambda record:
   record.name formats.

   If anyone has a better/cleaner solution I'd like to hear it..

   Thanks!


[web2py] Re: sqlhtml.py - breadcrumbs exception when using smartgrid format + lambda

2012-02-14 Thread Roderick
Being a noob at Python and Web2py, this is the best I could come up with:

In sqlhtml.py, insert the 2nd try block (below name = db[referee]._format 
% record) as follows:

try:
name = db[referee]._format % record
except TypeError:
try:
name = db[referee]._format(record)
except TypeError:
name = id

This seems to work for format=%(name)s and format=lambda record: 
record.name formats.

If anyone has a better/cleaner solution I'd like to hear it..

Thanks!


[web2py] Re: sqlhtml.py - breadcrumbs exception when using smartgrid format + lambda

2012-02-14 Thread Anthony
Please post an issue here: http://code.google.com/p/web2py/issues/list

On Tuesday, February 14, 2012 7:18:48 AM UTC-5, Roderick wrote:

 Being a noob at Python and Web2py, this is the best I could come up with:

 In sqlhtml.py, insert the 2nd try block (below name = db[referee]._format 
 % record) as follows:

 try:
 name = db[referee]._format % record
 except TypeError:
 try:
 name = db[referee]._format(record)
 except TypeError:
 name = id

 This seems to work for format=%(name)s and format=lambda record: 
 record.name formats.

 If anyone has a better/cleaner solution I'd like to hear it..

 Thanks!



[web2py] Re: sqlhtml.py - breadcrumbs exception when using smartgrid format + lambda

2012-02-14 Thread Massimo Di Pierro
Thanks fixed in trunk now.

On Feb 14, 6:18 am, Roderick roderick.m...@gmail.com wrote:
 Being a noob at Python and Web2py, this is the best I could come up with:

 In sqlhtml.py, insert the 2nd try block (below name = db[referee]._format
 % record) as follows:

                     try:
                         name = db[referee]._format % record
                     except TypeError:
                         try:
                             name = db[referee]._format(record)
                         except TypeError:
                             name = id

 This seems to work for format=%(name)s and format=lambda record:
 record.name formats.

 If anyone has a better/cleaner solution I'd like to hear it..

 Thanks!