本文整理汇总了Python中model.Article.title方法的典型用法代码示例。如果您正苦于以下问题:Python Article.title方法的具体用法?Python Article.title怎么用?Python Article.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Article
的用法示例。
在下文中一共展示了Article.title方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_article
# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import title [as 别名]
def test_create_article():
_author_id = random.randint(1, 20)
_new_article = Article()
_new_article.title = 'Test_Article_%s' % random.randint(100001, 999999)
_new_article.author_id = _author_id
_new_article.published_datetime = _new_article.last_modified_datetime = datetime.datetime.now()
_random_seed = str(random.random())
_new_article.digest = 'digest - %s' % (''.join(random.randint(2, 5)*md5(_random_seed).hexdigest()))
_content = ArticleContent(content='content - %s' % (''.join(random.randint(10, 50)*sha224(_random_seed).hexdigest())))
_new_article.content = _content
db_session.add(_new_article) # @UndefinedVariable
db_session.flush() # @UndefinedVariable
_catalogs = [
random.randint(1, 20),
random.randint(1, 20),
random.randint(1, 20),
]
for _cid in _catalogs:
db_session.execute(association_table_catalog_article.insert().values({ # @UndefinedVariable
'catalog_id': _cid,
'article_id': _new_article.id,
}))
db_session.commit() # @UndefinedVariable
示例2: addarticle
# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import title [as 别名]
def addarticle():
article=Article()
requeststr=request.query_string
params=utils.getArticleStr(unquote(requeststr))
article.title=params[0]
article.catagoryrelateid=params[1]
article.content=params[2]
article.addarticle()
return jsonify(msg='0000')
示例3: _gen_item
# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import title [as 别名]
def _gen_item(self, element):
item = Article()
item.url = self.url
item.title = element.find('h4').text()
item.author = u'廖雪峰'#element.find('').text()
item.category = 'Dev'
item.tags = 'Python'
contentWrapper = element.find('.x-wiki-content')#.remove('.postComment')
item.summary = tool.Tool().replace2(contentWrapper.outerHtml().encode('utf-8'))
item.crawl_time = datetime.datetime.now()
return item