Hello Allen,

my code looks like:
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.define_tables(username=True, migrate=False)
auth.wiki(resolve=False)
.
.
.


media=db.wiki_media
media.fields.append(Field('filedata', 'blob'))
media.filedata.represent = lambda value,row: \
    A('get it', _href=URL('download', args=value))
db.wiki_media.filename.uploadfield='filedata'
And produces the error:

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 103, in 
<module>
    media.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'

So I think I'm close. Just not aware of how to add that field yet.

-Bill



On Friday, October 12, 2012 5:08:18 PM UTC-5, Alan Etkin wrote:
>
> ¿What error do you get?
>
> To force the wiki class to define the tables before serving the wiki pages 
> (so you can customize them) you must add something like this to the model
>
> auth.wiki(resolve=False)
>
> El viernes, 12 de octubre de 2012 18:47:10 UTC-3, Bill Thayer escribió:
>>
>> I applied the patch to gluon tools (basically just give the 
>> Wiki.__init__(...,render=None,...) a default value of 'markmin' instead of 
>> None to remove the first error. Now I need to add an upload field to 
>> wiki_media but this does not work:
>>
>>
>>
>> media=db.tables(db.wiki_media)
>> media.fields.append(Field('filedata', 'blob'))
>> media.filedata.represent = lambda value,row: \
>>     A('get it', _href=URL('download', args=value))
>> db.wiki_media.filename.uploadfield='filedata'
>>
>>
>>
>>
>>
>>
>>
>>
>> On Friday, October 12, 2012 3:48:11 PM UTC-5, Bill Thayer wrote:
>>>
>>> I'm just starting down the same road so I hope you found success or at 
>>> least some resources.
>>>
>>> So far I've had to manually add the tables found in tools.py to Oracle. 
>>>
>>> From here it looks like I might need:
>>>
>>>
>>>
>>> from gluon.tools import Auth, Crud, Service, PluginManager, prettydate, 
>>> Wiki
>>> auth = Auth(db)
>>> crud, service, plugins = Crud(db), Service(), PluginManager()
>>> wiki = Wiki(auth=auth, render='html')
>>> or perhaps I'll put it after
>>>
>>> auth.define_tables(username=True, migrate=False)
>>>
>>> I'll keep you posted.
>>>
>>> -Bill
>>>
>>> On Friday, September 21, 2012 7:44:13 PM UTC-5, guruyaya wrote:
>>>>
>>>> I'm trying to figure out how to use the built in auth.wiki feature. 
>>>> I read the markmin syntax allows expending the syntax using the "extra" 
>>>> tag. Is there a way to implement it in auth.wiki? where should the de of 
>>>> the extra functionality be?
>>>>
>>>> *Is there a guide containing all options for this feature?*
>>>>
>>>> Thanks in advance
>>>> Yair 
>>>>
>>>

-- 



Reply via email to