You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Bhuvaneswaran Arumugam <bh...@collab.net> on 2006/07/02 06:21:24 UTC

[PATCH] svn2rss.py: Handle '--item-url' and '--feed-url' optionsand validate them

Hello,

Please find attached the patch!

[[[
Handle '--item-url' and '--feed-url' options and validate them

* contrib/hook-scripts/svn2rss.py
  (__doc__): Change the note for new options
  (import): re library
  (match_url): New function to validate the url
  (global): Define list of regex patterns to match for urls, get these
  options and validate them
  (SVN2RSS.__init__): Accept new 'feed_url' parameter and use them while
  generating the RSS feed
]]]

-- 
Regards,
Bhuvaneswaran

Re: [PATCH] svn2rss.py: Handle '--item-url' and '--feed-url' optionsand validate them

Posted by "C. Michael Pilato" <cm...@collab.net>.
Bhuvaneswaran Arumugam wrote:
> Hello,
> 
> Please find attached the patch!
> 
> [[[
> Handle '--item-url' and '--feed-url' options and validate them
> 

[...]

> +def match_url(url, opt):
> +    """ match the url in url_res """
> +
> +    match = 0
> +    for url_re in url_res:
> +        if(url_re.match(url)):
> +            match = 1
> +
> +    if(match == 0):
> +        usage_and_exit("svn2rss.py: Invalid url '%s' is specified for \
> +                        '%s' option" % (url, opt))

No need for regular expressions here.  A simple string.startswith() meets
your needs.

Committed (with this tweak, and some other small ones) in r20376.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand