def get_message(service, message_id): try: message_content = service.users().messages().get( userId='me', id=message_id).execute() if (message_content['labelIds'][1] == 'INBOX' or message_content['labelIds'][1] == 'UNREAD' or message_content['labelIds'][2] == 'INBOX'): texto = message_content['snippet'] if (texto.find('NF-e') > 0): get_attachment_id = message_content['payload']['parts'][1][ 'body']['attachmentId'] get_attachment(service=service, message_id=message_id, attachment_id=get_attachment_id) except: pass
def modify_get(self, board_name, board_id, article_id, current_uid = -1): if not acl.is_allowed('article', article_id, current_uid, 'modify'): return util.render().error(error_message = _('NO_PERMISSION'), help_context='error') board_info = board.get_board_info(board_id) board_desc = board_info.bDescription article_ = article.get_article(board_id, article_id) uploads = attachment.get_attachment(article_id) return util.render().article_edit( title = _('Modify - /%s')% board_name, stylesheet = board_info.stylesheet, action='modify/%s' % article_id, action_name = _('Modify article'), board_path = board_name, board_desc = board_desc, article_title = article_.aTitle, body = article_.aContent, attachment = uploads, help_context = 'article_edit')
def read_get(self, board_name, board_id, article_id): board_info = board.get_board_info(board_id) board_desc = board_info.bDescription a = article.get_article(board_id, article_id) comment = article.get_comment(article_id) #새글읽기 처리 if web.ctx.session.has_key('uid'): uSerial = web.ctx.session.uid user.read_article(uSerial, article_id) read_articles = web.cookies().get('read_articles') if read_articles: try: read_articles = [int(i) for i in read_articles.split(';')] if article_id not in read_articles: article.increase_read_count(article_id) read_articles.append(article_id) except ValueError: read_articles = [] else: article.increase_read_count(article_id) read_articles = [article_id] read_articles.sort() read_articles = ';'.join(['%s' % i for i in read_articles]) web.setcookie('read_articles', read_articles, 3600) prev_id = -1 next_id = -1 if not a: raise web.notfound(util.render().error(error_message = _('NO_SUCH_ARTICLE'), help_context='error')) if a.aIndex > 1: prev_id = article.get_article_id_by_index(board_id, a.aIndex - 1) if a.aIndex < article._get_article_count(board_id): next_id = article.get_article_id_by_index(board_id, a.aIndex + 1) page_no = article.get_page_by_article_id(board_id, article_id, config.page_size) uploads = attachment.get_attachment(article_id) thumbs = attachment.get_thumbnail(article_id, web.config.theme) return util.render().article(article = a, title = u"%s - %s" % (a.aIndex, a.aTitle), stylesheet = board_info.stylesheet, board_path = board_name, board_desc = board_desc, comments = comment, page_no = page_no, prev_id = prev_id, next_id = next_id, feed = True, attachment = uploads, thumbnail = thumbs, help_context = 'read_article')