def get(self): author = Author.all().get() if not author: author = Author() author.name = u'username' author.nickname = u'nickname' author.passwd = hashlib.md5('passwd').hexdigest() author.blog_title = u'title' author.blog_theme = u'default' author.blog_domain = u'localhost' author.blog_timezone = 8 author.sync_key = hashlib.md5('sync_key').hexdigest() # 通过 web service api 同步文章 author.put() self.redirect('/writer/signin/')
def post(self): author = Author.all().get() if not author: author = Author() author.name = 'ratazzi' author.nickname = 'Ratazzi' author.blog_title = self.get_argument('blog_title', default='', strip=True) author.blog_theme = self.get_argument('blog_theme', default='default', strip=True) author.blog_domain = self.get_argument('blog_domain', default='', strip=True) author.blog_timezone = int(self.get_argument('blog_timezone', default=0, strip=True)) author.sync_key = self.get_argument('sync_key', default='', strip=True) author.twitter_user = self.get_argument('twitter_user', default='', strip=True) author.twitter_passwd = self.get_argument('twitter_passwd', default='', strip=True) author.put() self.redirect('/writer/')