* some better regex
authorthib
Fri Oct 17 15:52:49 2008 +0000 (2008-10-17)
changeset 5edd1c64ef64b
parent 4 cd13f0a9e521
child 6 9de85bfd9d30
* some better regex
* a post that is not found is not public
PyThiBloG/modules/atom.py
PyThiBloG/modules/post.py
PyThiBloG/post.py
     1.1 --- a/PyThiBloG/modules/atom.py	Thu Oct 16 20:09:00 2008 +0000
     1.2 +++ b/PyThiBloG/modules/atom.py	Fri Oct 17 15:52:49 2008 +0000
     1.3 @@ -38,11 +38,11 @@
     1.4      
     1.5      @classmethod
     1.6      def match_request(cls, uri):
     1.7 -        if re_match(r'^\/atom\/?$', uri) is not None:
     1.8 +        if re_match(r'^/atom/?$', uri) is not None:
     1.9              return True
    1.10 -        elif re_match(r'^\/atom\/comments((\/[0-9]+)|\/spam)?\/?$', uri) is not None:
    1.11 +        elif re_match(r'^/atom/comments((/[0-9]+)|/spam)?/?$', uri) is not None:
    1.12              return True
    1.13 -        elif re_match(r'^\/atom\/tag\/[a-zA-Z0-9_-]+\/?$', uri) is not None:
    1.14 +        elif re_match(r'^/atom/tag/[a-zA-Z0-9_-]+/?$', uri) is not None:
    1.15              return True
    1.16          return False
    1.17      
     2.1 --- a/PyThiBloG/modules/post.py	Thu Oct 16 20:09:00 2008 +0000
     2.2 +++ b/PyThiBloG/modules/post.py	Fri Oct 17 15:52:49 2008 +0000
     2.3 @@ -31,7 +31,7 @@
     2.4      
     2.5      @classmethod
     2.6      def match_request(cls, uri):
     2.7 -        return re_match(r'^[/]((posts|comment|tags)/[a-zA-Z0-9]*)*$', uri) is not None
     2.8 +        return re_match(r'^/(((posts|comment)/[0-9]+)|(tags/[a-zA-Z0-9]+)/?)?$', uri) is not None
     2.9      
    2.10      @classmethod
    2.11      def process_request(cls, req):
     3.1 --- a/PyThiBloG/post.py	Thu Oct 16 20:09:00 2008 +0000
     3.2 +++ b/PyThiBloG/post.py	Fri Oct 17 15:52:49 2008 +0000
     3.3 @@ -81,6 +81,7 @@
     3.4                  content = 'The content you requested has not been found.'
     3.5                  content += ' Either it doesn\'t exist yet, either it has been deleted.'
     3.6                  date = datetime.now()
     3.7 +                public = False
     3.8  
     3.9          self.id = id
    3.10          self.title = title