Hmmm. These lines do not work so I'm unsure where to insert them.

db.wiki_media.filename.uploadfield='filedata'
db.wiki_page.filedata.represent = lambda value,row: \
    A('get it', _href=URL('download', args=value))
Here's the error as usual.

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 209, in restricted
    exec ccode in environment
  File "C:/web2py/applications/TAMOTO/models/db.py" 
<http://127.0.0.1:8000/admin/default/edit/TAMOTO/models/db.py>, line 68, in 
<module>
    db.wiki_page.filedata.represent = lambda value,row: \
  File "C:\web2py\gluon\dal.py", line 7626, in __getitem__
    return ogetattr(self, str(key))
AttributeError: 'Table' object has no attribute 'filedata'

The code now looks like:
 db = DAL(settings.database_uri, check_reserved=['oracle'], migrate_enabled=
False, fake_migrate_all=True)
    session.secure()
    session.connect(request, response, db)
.
.
.
from gluon import DAL
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate, Wiki
auth = Auth(db)
crud, service, plugins = Crud(db), Service(), PluginManager()
## create all tables needed by auth if not custom tables
auth.settings.extra_fields['auth_user']= [
  Field('business_unit', length=15),
  Field('default_charge_number', length=15),
  Field('location', length=15),
  Field('phone', length=12)]
auth.settings.extra_fields["wiki_media"] = [Field("filedata", "blob"),]


auth.wiki(resolve=False)
db.wiki_media.filename.uploadfield='filedata'
db.wiki_page.filedata.represent = lambda value,row: \
    A('get it', _href=URL('download', args=value))

auth.define_tables(username=True, migrate=False, fake_migrate=True)
.
.
.





On Sunday, October 14, 2012 4:06:09 PM UTC-5, Alan Etkin wrote:
>
> El domingo, 14 de octubre de 2012 15:56:05 UTC-3, Bill Thayer escribió:
>>
>> I tried your patch but the tables were not defined. Is my db.py code 
>> correct? The commented out code causes an error<type 
>> 'exceptions.AttributeError'>('DAL' object has no attribute 'wiki_media') 
>> but when commented out the appadmin displays all the tables except the 
>> wiki_ tables.
>>
>
> I think this command is missing:
>
> # after  auth.settings.extra_fields ...
> auth.wiki(resolve=False)
>
> Without that line, the tables will not be available within the controller 
> or the model
>

-- 



Reply via email to