On Fri, 17 Apr 2009 14:44:57 +0200, "Vreman, Peter - Acision"
<peter.vreman(a)acision.com> wrote:
> >> I notice in your django patch, you are using query
strings in the
URL.
> >> One
> >> of the design points of django is to have "pretty" URLs. So
instead
> >> of
> >> having ?page=XX, it should simply be /xx at the end to indicate the
> page.
> >> It makes life much easier not having to dig variables out of the
> request
> >> object, just build it into the view.
> >
> > I did that by design.
> >
> > - Supporting filters and the paging, sorting etc. can be ambiguous in
> > an
> > URL. E.g. how to parse the URL 1 and 3?
> > 1. /cobbler_web/system/list/1
> > 2. /cobbler_web/system/list/my_filter/1
> > 3. /cobbler_web/system/list/my_filter
> > 4. /cobbler_web/system/list/sortipaddr
>
> Easy, with regex:
>
> 1. (r'^cobbler_web/system/list/(?P<page>\d+)$', system_list),
> 2.
(r'^cobbler_web/system/list/filter/(?P<filter>\w+)/(?P<page>\d+)$',
> system_list),
> 3. (r'^cobbler_web/system/list/filter/(?P<filter>\w+)$',
system_list),
> 4.
(r'^cobbler_web/system/list/sort/(?P<sortfield>\w+)$',
> system_list),
>
> I'm sure we could collapse all of these down into one, I just haven't
> looked into it yet. It's just regex though, so it shouldn't be that
> difficult to specify optional parameters, something like
> "[/option/(?<parameter>\w+)]?".
>
If you want to have django pass the parameters as variables you end up
with
"2^^<number_of_options>-1" number of rules. Below is
an example for the 4
options "filter, sort, limit and page" that my code supports.
(r'^cobbler_web/system/list/$', system_list),
(r'^cobbler_web/system/list/(?P<page>\d+)$', system_list),
(r'^cobbler_web/system/list/limit/(?P<limit>\d+)/$', system_list),
(r'^cobbler_web/system/list/limit/(?P<limit>\d+)/(?P<page>\d+)$',
system_list),
(r'^cobbler_web/system/list/sort/(?P<sortfield>\w+)/$', system_list),
(r'^cobbler_web/system/list/sort/(?P<sortfield>\w+)/(?P<page>\d+)$',
system_list),
(r'^cobbler_web/system/list/sort/(?P<sortfield>\w+)/limit/(?P<limit>\d+)/$',
system_list),
(r'^cobbler_web/system/list/sort/(?P<sortfield>\w+)/limit/(?P<limit>\d+)/(?P<page>\d+)$',
> system_list),
>
> (r'^cobbler_web/system/list/filter/(?P<filter>\w+)/$', system_list),
>
(r'^cobbler_web/system/list/filter/(?P<filter>\w+)/(?P<page>\d+)$',
system_list),
(r'^cobbler_web/system/list/filter/(?P<filter>\w+)/limit/(?P<limit>\d+)/$',
system_list),
(r'^cobbler_web/system/list/filter/(?P<filter>\w+)/limit/(?P<limit>\d+)/(?P<page>\d+)$',
system_list),
(r'^cobbler_web/system/list/filter/(?P<filter>\w+)/sort/(?P<sortfield>\w+)/$',
system_list),
(r'^cobbler_web/system/list/filter/(?P<filter>\w+)/sort/(?P<sortfield>\w+)/(?P<page>\d+)$',
system_list),
(r'^cobbler_web/system/list/filter/(?P<filter>\w+)/sort/(?P<sortfield>\w+)/limit/(?P<limit>\d+)/$',
system_list),
(r'^cobbler_web/system/list/filter/(?P<filter>\w+)/sort/(?P<sortfield>\w+)/limit/(?P<limit>\d+)/(?P<page>\d+)$',
system_list),
I don't think this is maintainable.
As I said above, i'm pretty sure we can collapse this down using regex.
What are your ideas about the action URL that makes the preference
changes
and then redirects back the list?
The only time we should be using the request object (in my opinion) is when
making POSTs through forms. This is done whenever saving cobbler objects
back to the system.
Peter
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be
copied,
disclosed to, retained or used by, any other party. If you are not
an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
_______________________________________________
cobbler-devel mailing list
cobbler-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler-devel
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.