michael sun
2015-07-25 01:45:18 UTC
I build a table:
db.define_table('image',
Field('title', unique=True),
Field('file', 'upload'),
format = '%(title)s')
then upload a image called 'water'.
in index.html, I wrote:
<img src="{{=URL('download',args=db.image.water)}}" />
but then it gives me the error:
<type 'exceptions.AttributeError'>()
Function argument list
(self=<Table image (id,title,file)>, key='water')
Code listing
343.
344.
345.
346.
347.
348.
349.
350.
351.
352.
def __getattr__(self, key):
try:
return self.__dict__.__getitem__(str(key))
except:
raise AttributeError
def __setitem__(self, key, value):
self.__dict__.__setitem__(key, value)
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
db.define_table('image',
Field('title', unique=True),
Field('file', 'upload'),
format = '%(title)s')
then upload a image called 'water'.
in index.html, I wrote:
<img src="{{=URL('download',args=db.image.water)}}" />
but then it gives me the error:
<type 'exceptions.AttributeError'>()
Function argument list
(self=<Table image (id,title,file)>, key='water')
Code listing
343.
344.
345.
346.
347.
348.
349.
350.
351.
352.
def __getattr__(self, key):
try:
return self.__dict__.__getitem__(str(key))
except:
raise AttributeError
def __setitem__(self, key, value):
self.__dict__.__setitem__(key, value)
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.