On Mon, Jun 2, 2014 at 7:49 PM, Alexandr Shurigin
<alexandr.shuri...@gmail.com> wrote:
> Hi all!
>
> Yestarday i released beta version of new django routing helper component.
>
> Routing must be simple. Now we talking with django core team about making
> django routing simpler by default.
>
> If anybody is interested about it, you can use right now my component to
> make your routes simple, clean and readable in future instead of native
> regular expressions.
>
> http://phpdude.github.io/django-macros-url/
>

This looks interesting - at first glance I would have dismissed this
(once you know PCRE, why learn another set of rules?) I'm glad I
looked further, because this is not a new lingo; it just provides some
macro magic to save some space, repetition and avoid mistakes, so this
does seem a very useful thing to have.

It's very similar to adding POSIX style regular expression named
character sets (and user defined ones at that) to re, and does
simplify and normalize your rules. I wonder if conceptually and
visually it might work better pretending they are named character
sets, eg:

  macrosurl.url('search/[:search_id:]')

Two things:

Sometimes I have two things of the same type, eg two attributes that
are search ids. How would I specify the names of the parameters with a
macro?

Secondly:

> Once Macros Url finished compile regex pattern, it makes normalization of it 
> by rules:
> Strip from left side all whitespace and ^
> Strip from right side of pattern all whitespace and $
> Add to left side ^
> Add to right side $

So why bother include the ^$ in your examples, save an extra couple of
characters!

Cheers

Tom

PS: I know python re is not "PCRE", but it is a good term to describe
the several perl-like RE implementations (Perl, PCRE, Python etc).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1%2B7aUofkOxG6HwD7WOvm_XR2JfPBVQ-UeM2YdZEkxYNPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to