I don't know about webfaction but on my local PC I prefer using the
development version from http://code.google.com/p/web2py/ mainly because
it's much easier to update from the SVN repository.
I keep 'web2py' in `~/bin` separate from my 'web2py' applications
which I keep in `~/projects/web2py/applications`.
# Checkout the latest web2py trunk.
$ cd ~/bin
$ svn checkout http://web2py.googlecode.com/svn/trunk/ web2py
# Set admin password and installs example apps.
$ cd web2py
$ python web2py.py
# Link any existing web2py applications.
$ cd applications
$ ln -s ~/projects/web2py/applications/* .
To update:
$ cd ~/bin/web2py
$ svn update
Cheers, Stuart
If it is in applications/library/modules/helpers.py than it is likely
you are not passing the request to the function in the module.
helpers.request=request
Or add request details to the environment's existing request, for example:
helpers.request.folder='applications/examples/'
Cheers, Stuart
> in applications/library/modules/helpers.py
> from gluon.html import *
> def myfun(request):
> ...
> A('blabla', _href=URL(r=request,f='function'))
> ....
>
> def function():
> ....
>
>
> while in the controller default.py of my init application:
>
> import applications.library.modules.helpers as helpers
> getresult=helpers.myfun
>
> and then call getresult(request)
This wouldn't this prohibit helpers that require dynamic environment
objects e.g. timesince() uses T
(http://mdp.cti.depaul.edu/AlterEgo/default/show/130)
or should all helpers be explicitly passed any required dynamic objects?
everything else can just be imported.
The reason is that stuff in a module should not be really translated
in the module because they should not hardcode strings. Strings
should be passed already translated. I would just put timesince in a
model file and give it an appropriate name to make things simpler.
Massimo
Makes the use of exec_environment() inadvisable for helpers, it's much
better to explicitly pass the environment as function args and use the
Python module import statement.