def get(self): ''' arguments of this request: q = 'compose' -> create a new blog q = 'modify' -> modify a exist blog id -> id of the entry to modify ''' if self.get_argument('q') == 'compose': # craete a new entry self._majo_background_render( template_name='compose', header_message='Compose a new blog ...', title='', category='', content='', post_id=-1) elif self.get_argument('q') == 'modify': # modify an exist entry entry_id = int(self.get_argument('id')) entry = meidodb.get_entry(entry_id) self._majo_background_render( template_name='compose', header_message='Modify an exist blog ...', title=entry['title'], category=entry['category'], content=entry['content'], post_id=entry_id)
def get(self): """ arguments of this request: q = 'compose' -> create a new blog q = 'modify' -> modify a exist blog id -> id of the entry to modify """ if self.get_argument("q") == "compose": # craete a new entry self._majo_background_render( template_name="compose", header_message="Compose a new blog ...", title="", category="", content="", post_id=-1, ) elif self.get_argument("q") == "modify": # modify an exist entry entry_id = int(self.get_argument("id")) entry = meidodb.get_entry(entry_id) self._majo_background_render( template_name="compose", header_message="Modify an exist blog ...", title=entry["title"], category=entry["category"], content=entry["content"], post_id=entry_id, )
def get(self, request): entry = meidodb.get_entry(int(request)) if entry == None: self.redirect(u'/message?m=这个页面貌似不存在呢TwT') return self._meido_render(content_type='entry', entry=entry)
def get(self, request): entry = meidodb.get_entry(int(request)) if entry == None: self.redirect(u"/message?m=这个页面貌似不存在呢TwT") return self._meido_render(content_type="entry", entry=entry)
def get(self): # next argument is where this page comes from type = self.get_argument("type") id = int(self.get_argument("id")) if type == "entry": item = meidodb.get_entry(id) elif type == "comment": item = meidodb.get_comment_by_id(id) next_page = self.get_argument("next") self._majo_background_render( template_name="remove", type=self.get_argument("type"), item=item, id=id, next=next_page )
def render(self, entry_id): comments = meidodb.get_comment_by_entry(entry_id) if 0 == len(comments): return '<p class="nocomments">No Comments.</p>' else: count = 1 render_str_list = [] for comment in comments: render_str_list.append(self.render_string( 'comment.html', comment = comment, time = time.strftime('%B %d, %Y at %I:%M %p', comment['comment_time']), floor = count)) count = count + 1 entry = meidodb.get_entry(entry_id) h3_str = '<h3 id="comments-wrap">{0} Comments to "{1}"</h3>'.format(len(render_str_list), entry['title']) return h3_str + '<ol class="commentlist">' + ''.join(render_str_list) + '</ol>'
def get(self): # next argument is where this page comes from type = self.get_argument('type') id = int(self.get_argument('id')) if type == 'entry': item = meidodb.get_entry(id) elif type == 'comment': item = meidodb.get_comment_by_id(id) next_page = self.get_argument('next') self._majo_background_render(template_name='remove', type=self.get_argument('type'), item=item, id=id, next=next_page)
def render(self, entry_id): comments = meidodb.get_comment_by_entry(entry_id) if 0 == len(comments): return '<p class="nocomments">No Comments.</p>' else: count = 1 render_str_list = [] for comment in comments: render_str_list.append( self.render_string('comment.html', comment=comment, time=time.strftime( '%B %d, %Y at %I:%M %p', comment['comment_time']), floor=count)) count = count + 1 entry = meidodb.get_entry(entry_id) h3_str = '<h3 id="comments-wrap">{0} Comments to "{1}"</h3>'.format( len(render_str_list), entry['title']) return h3_str + '<ol class="commentlist">' + ''.join( render_str_list) + '</ol>'