[web2py] Re: editing gluon.tools

2012-10-11 Thread Bill Thayer
Thank you!

On Wednesday, October 10, 2012 8:54:16 PM UTC-5, Massimo Di Pierro wrote:

 This has already been fixed in trunk and the nightly built. file was 
 replaced by filename. 

 On Wednesday, 10 October 2012 19:18:24 UTC-5, Bill Thayer wrote:

 This question should show my lack of Python knowledge but here goes...

 In gluon.tools 

 def Wiki(object):
 .
 .
 .
 table_definitions = {
 'wiki_page':{
 'args':[
 Field('slug',
   requires=[IS_SLUG(),
 IS_NOT_IN_DB(db,'wiki_page.slug')],
   readable=False,writable=False),
 Field('title',unique=True),
 Field('body','text',notnull=True),
 Field('tags','list:string'),
 Field('can_read','list:string',
   writable=perms,
   readable=perms,
   default=[Wiki.everybody]),
 Field('can_edit', 'list:string',
   writable=perms,readable=perms,
   default=[Wiki.everybody]),
 Field('changelog'),
 Field('html','text',compute=render,
   readable=False, writable=False),
 auth.signature],
 'vars':{'format':'%(title)s'}},
  'wiki_tag':{
 'args':[
 Field('name'),
 Field('wiki_page','reference wiki_page'),
 auth.signature],
 'vars':{'format':'%(name)s'}},
'wiki_media':{
 'args':[
 Field('wiki_page','reference wiki_page'),
 Field('title',required=True),
 Field('file','upload',required=True),
 auth.signature],
 'vars':{'format':'%(title)s'}}
 }


 Since file is an Oracle keyword and I'd like to save my file_data in the 
 database how do I overwrite this Wiki class and still have it work in my 
 application?

 Should I just edit gluon.tools? That seems dangerous when it comes time 
 to upgrade. I also want 

  db.wiki_media.file_data.represent = lambda value,row: \ A('get it',_href
 =URL('download', args=value))


 but I think I can add that to db.py

 Perhaps I should copy gluon.tools to my application modules folder and 
 edit it there?

 Regards,
 Bill



-- 





[web2py] Re: editing gluon.tools

2012-10-10 Thread Massimo Di Pierro
This has already been fixed in trunk and the nightly built. file was 
replaced by filename. 

On Wednesday, 10 October 2012 19:18:24 UTC-5, Bill Thayer wrote:

 This question should show my lack of Python knowledge but here goes...

 In gluon.tools 

 def Wiki(object):
 .
 .
 .
 table_definitions = {
 'wiki_page':{
 'args':[
 Field('slug',
   requires=[IS_SLUG(),
 IS_NOT_IN_DB(db,'wiki_page.slug')],
   readable=False,writable=False),
 Field('title',unique=True),
 Field('body','text',notnull=True),
 Field('tags','list:string'),
 Field('can_read','list:string',
   writable=perms,
   readable=perms,
   default=[Wiki.everybody]),
 Field('can_edit', 'list:string',
   writable=perms,readable=perms,
   default=[Wiki.everybody]),
 Field('changelog'),
 Field('html','text',compute=render,
   readable=False, writable=False),
 auth.signature],
 'vars':{'format':'%(title)s'}},
  'wiki_tag':{
 'args':[
 Field('name'),
 Field('wiki_page','reference wiki_page'),
 auth.signature],
 'vars':{'format':'%(name)s'}},
'wiki_media':{
 'args':[
 Field('wiki_page','reference wiki_page'),
 Field('title',required=True),
 Field('file','upload',required=True),
 auth.signature],
 'vars':{'format':'%(title)s'}}
 }


 Since file is an Oracle keyword and I'd like to save my file_data in the 
 database how do I overwrite this Wiki class and still have it work in my 
 application?

 Should I just edit gluon.tools? That seems dangerous when it comes time to 
 upgrade. I also want 

  db.wiki_media.file_data.represent = lambda value,row: \ A('get it', _href
 =URL('download', args=value))


 but I think I can add that to db.py

 Perhaps I should copy gluon.tools to my application modules folder and 
 edit it there?

 Regards,
 Bill


--