sloecode-dev team mailing list archive
-
sloecode-dev team
-
Mailing list archive
-
Message #00025
Re: configurable root path of sloecode instance
Thanks for the reply.
On Wed, 01 Jun 2011 7:09:33 PM Thomi Richards wrote:
> There are two issues with this. One of them is easy to solve, and one
> requires a bit of typing (but not thinking so much):
>
> First, since we're using python-routes to map URLs to controllers we
> can easily change the root path of the sloecode instance. All that
> would be required is a change to the routes configuration - it
> shouldn't be hard to put this in the config file, so it can be easily
> changed. That's the easy part.
For someone who knows this web framework: probably.
> The hard part is that in some places we've been a bit...sloppy with
> our template code: we've hard coded URL paths in many places, instead
> of using the url_for method. An example of it done correctly is:
>
> sloecode/templates/project-manage-users.html:13 where we have the
> following: {{ h.form( h.url_for(controller='/project', project_name =
> project_name, action='process_manage_users') ) }}
That seems to be the only one that uses form submission, as far as my
recursive grepping has revealed.
Beyond that, there are (potentially) some more that might need fixing:
* Links to style sheets/JavaScript in lines 10-15:
sloecode/templates/base.html
* Links to personal pages in line 31:
sloecode/templates/admin/person-list.html
* Link to help:
sloecode/templates/admin/person-create.html (line 19)
sloecode/templates/admin/person-update.html (line 60)
sloecode/templates/person-details.html (line 40)
* As mentioned before:
sloecode/templates/login.html (line 18)
(don't know whether also needed for the hidden field in line 32)
* Link to login in line 16:
sloecode/templates/index.html
* Image links:
sloecode/templates/person-details.html (line 46)
sloecode/templates/project-details.html (line 35)
* Link to project details:
sloecode/templates/project-details.html (line 59)
> This form action uses a URL path generated by 'url_for', which
> resolves the controller name, action name, and parameters to a URL
> path by looking at the python-routes mapper and returning the correct
> string. However, in some places, such as:
>
> sloecode/templates/login.html:18 we have a hard-coded path:
> {{ h.form('/auth/dologin', name="login_form") }}
Unfortunately the url_for() function takes different parameters, so I'm not
sure how to wrap it around those calls, to fix this up directly ... :-/
> There's an existing bug report for this:
>
> https://bugs.launchpad.net/sloecode/+bug/700202
>
> I have spent some time in the past converting all the admin templates,
> so those should work (unless hard-coded paths have snuck back in
> again). This is the kind of job that can be done incrementally, and is
> pretty easy to code & verify that you've done the right thing (what
> I'm trying to say here is "merge proposals are most welcome" :P).
If one tells me how to do it, I'll put it into my branch and propose a merge
:)
> Finally, it'd be super cool if we could hook up the pylons functional
> unit tests to test for this kind of thing - it should be pretty easy
> to iterate over all the controller actions and verify that when we
> move the root path the actions are still accessible at the new path.
>
> Anyway, it's one of those things that I'll probably get around to
> squashing one afternoon when I just want to get something completed.
> These days it seems like I'm struggling with debian packaging and not
> writing much code at all.
And we're all very glad for that effort!!!
And I will help if I know how to. I'm going to try to get a Sphinx skeleton
into it now for the ReST documentation.
Guy
--
Guy K. Kloss
School of Computing + Mathematical Sciences
Auckland University of Technology
Private Bag 92006, Auckland 1142
phone: +64 9 921 9999 ext. 5032
eMail: Guy.Kloss@xxxxxxxxx
Attachment:
signature.asc
Description: This is a digitally signed message part.
Follow ups
References