コード例 #1
0
ファイル: webapp.py プロジェクト: fczuardi/teh
def main():
    application = webapp.WSGIApplication([
        (r"/teh/", HomePageHandler),
        (r"/teh/login", LoginHandler),
        (r"/teh/logout", LogoutHandler),

        (r"/teh/entries", teh.blog.EntryIndexHandler),
        (r"/teh/feed", teh.blog.FeedHandler),
        (r"/teh/entry/([^/]+)", teh.blog.EntryHandler),
        (r"/teh/entry/([^/]+)/edit", teh.blog.NewEntryHandler),
        (r"/teh/entry/([^/]+)/del", teh.blog.EntryDeleteHandler),
        (r"/teh/([^/]+)/edit", teh.blog.NewEntryHandler),
        (r"/teh/([^/]+)/del", teh.blog.EntryDeleteHandler),
        (r"/teh/topic/([^/]+)", teh.blog.TagHandler),
        
        (r"/teh/admin", teh.admin.AdminHandler),
        (r"/teh/admin/new", teh.blog.NewEntryHandler),
        (r"/teh/admin/config", teh.admin.ConfigHandler),
        (r"/teh/admin/entrylist", teh.admin.EntryListHandler),

       # (r"/shooin/([^/]+)", shooin.ShooinHandler),
        (r"/teh/([^/]+)", teh.blog.PageHandler),
        ], debug=True)
    
    config = TehConfig.all()
    if config.count() > 0:
        config = config.fetch(1)[0]
    else: 
        config1 = TehConfig(title="TEH Blog")
        config1.put()
       
    wsgiref.handlers.CGIHandler().run(application)
コード例 #2
0
ファイル: admin.py プロジェクト: fczuardi/teh
 def post(self):
     config = TehConfig.all()
     config = config.fetch(1)[0]
     config.title = self.request.get("title")
     config.disqus = self.request.get("disqus")
     config.put()
     self.redirect('../admin')