I have the following function:
def logo():
vertexID = get_vertexID(auth, session)
folder = 'vertexID' + str(vertexID)
table.image.uploadfolder =
os.path.join(request.env.applications_parent, 'applications',
'dbmodel', 'static', 'uploads',
folder)
record = table(vertexID=vertexID)
form = SQLFORM(table, record, deletable=False, showid=False,
upload=URL('dbmodel', 'static', 'uploads', folder,
args=request.vars.image))
if hasattr(request.vars.image, 'filename'):
form.vars.imageFilename = request.vars.image.filename
if form.process().accepted:
get_flash(session, None, 'success', 'success')
redirect(rdrctUrl)
elif form.errors:
get_flash(response, None, 'danger', 'error')
elif not response.flash:
get_flash(response, None 'info', 'info')
return dict(form=form)
This did work, however, after changing the applications name from org to com
it no longer does, I get the following error:
Traceback (most recent call last):
File "/Users/iannet/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/Users/iannet/web2py/applications/com/controllers/image.py"
<http://127.0.0.1:8000/admin/default/edit/com/controllers/image.py>, line 190,
in <module>
File "/Users/iannet/web2py/gluon/globals.py", line 417, in <lambda>
self._caller = lambda f: f()
File "/Users/iannet/web2py/gluon/tools.py", line 4258, in f
return action(*a, **b)
File "/Users/iannet/web2py/gluon/tools.py", line 4258, in f
return action(*a, **b)
File "/Users/iannet/web2py/applications/com/controllers/image.py"
<http://127.0.0.1:8000/admin/default/edit/com/controllers/image.py>, line 66,
in logo
upload=URL('dbmodel', 'static', 'uploads', folder, args=request.vars.image))
File "/Users/iannet/web2py/gluon/html.py", line 285, in URL
application = r.application
AttributeError: 'str' object has no attribute 'application'
Function argument list
(a='dbmodel', c='static', f='uploads', r='vertexID1147', args=[], vars={},
anchor='', extension=None, env=None, hmac_key=None, hash_vars=True,
salt=None, user_signature=None, scheme=None, host=None, port=None,
encode_embedded_slash=False, url_encode=True, language=None)
284.
285.
286.
287.
288.
289.
from globals import current
if hasattr(current, 'request'):
r = current.request
if r:
application = r.application
controller = r.controller
function = r.function
env = r.env
if extension is None and r.extension != 'html':
Variables
application None
r 'vertexID1147'
r.application undefined
According to variables r has the value vertexID1147, which is the name of
the folder
where the logo should be stored.
Has this anything to with changing the applications name? In installed
applications org came after dbmodel,
now com comes before dbmodel. Or is there something else wrong?
Kind regards,
Annet
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.