Пример #1
0
 def findPost(self, currentBlog):
   match = re.match('/post/(\d+)/([-a-z0-9]+)', self.request.path)
   if not match:
     match = re.match('/post/([-a-z0-9]+)', self.request.path)
     stitle = match.group(1)
     if stitle:
       return Posts.GetPostBySmallName(stitle, currentBlog)
   else:
     sdate = match.group(1)
     stitle = match.group(2)
     if sdate and stitle:
       return Posts.query(Posts.small_date==sdate,
           Posts.small_name==stitle).get()
   return None