fa.jquery - url and template override

31 views
Skip to first unread message

Oliver Christen

unread,
Jul 26, 2011, 7:07:26 AM7/26/11
to FormAlchemy
rehello

Im having some problem with the url handling in the fa.jquery
templates.

my application is not running at the root path on the webserver and
the resources loaded directly from the template and the ones
dynamically loaded with javascript are not fetched using the correct
url.

my base url is :
http://myserver/ochriste/wsgi/
the admin controller is there :
http://myserver/ochriste/wsgi/admin/
and my User grid is there :
http://myserver/ochriste/wsgi/admin/User/models

the fa.jquery static resources are available at the url:
http://myserver/ochriste/wsgi/jquery/

the url generated by the url method defined in fa.jquery.utils
generate url like this (for example):
<script type="text/javascript" src="/jquery/fa.jquery.min.js"></
script>
which will never match, as they are missing the base part "ochriste/
wsgi/"

if I replace the
from fa.jquery.utils import url
by
from pylons import url

and modify the url call in the template like this:
<script type="text/javascript" src="${url('fa_static',
path_info='fa.jquery.min.js')}"></script>
instead of
<script type="text/javascript" src="${url('fa.jquery.min.js')}"></
script>

I get correct urls to the resources, but this is quite problematic as
I would need to modify all fa.jquery template.

is there a way to configure a base path so the fa.jquery.utils url
method return the correct path ?

also, what is the advised way to override cleanly the fa.jquery
templates ?

thanks in advance
best regards
Oliver

Gaël Pasgrimaud

unread,
Jul 26, 2011, 9:48:37 AM7/26/11
to forma...@googlegroups.com
You can use

you can change url.root_url

from fa.jquery.utils import url
url.root_url = blah

> also, what is the advised way to override cleanly the fa.jquery
> templates ?

Just add them to your templates/ directory

>
> thanks in advance
> best regards
> Oliver
>

> --
> You received this message because you are subscribed to the Google Groups "FormAlchemy" group.
> To post to this group, send email to forma...@googlegroups.com.
> To unsubscribe from this group, send email to formalchemy...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/formalchemy?hl=en.
>
>

Oliver Christen

unread,
Jul 26, 2011, 10:37:46 AM7/26/11
to FormAlchemy
thank you very much
this worked like a charm :)
Reply all
Reply to author
Forward
0 new messages