本文整理汇总了Python中past.model.status.Status._clear_cache方法的典型用法代码示例。如果您正苦于以下问题:Python Status._clear_cache方法的具体用法?Python Status._clear_cache怎么用?Python Status._clear_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类past.model.status.Status
的用法示例。
在下文中一共展示了Status._clear_cache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove_user
# 需要导入模块: from past.model.status import Status [as 别名]
# 或者: from past.model.status.Status import _clear_cache [as 别名]
def remove_user(uid):
user = User.get(uid)
if not user:
print '---no user:%s' % uid
print "---- delete from user, uid=", uid
db_conn.execute("delete from user where id=%s", uid)
db_conn.commit()
User._clear_cache(uid)
cursor = db_conn.execute("select id from status where user_id=%s", uid)
if cursor:
rows = cursor.fetchall()
for row in rows:
sid = row[0]
print "---- delete mongo text, sid=", sid
RawStatus.remove(sid)
print "---- delete from status, uid=", uid
db_conn.execute("delete from status where user_id=%s", uid)
db_conn.commit()
Status._clear_cache(uid, None)
print "---- delete from passwd, uid=", uid
db_conn.execute("delete from passwd where user_id=%s", uid)
print "---- delete from sync_task, uid=", uid
db_conn.execute("delete from sync_task where user_id=%s", uid)
print "---- delete from user_alias, uid=", uid
db_conn.execute("delete from user_alias where user_id=%s", uid)
db_conn.commit()
示例2: remove_user
# 需要导入模块: from past.model.status import Status [as 别名]
# 或者: from past.model.status.Status import _clear_cache [as 别名]
def remove_user(uid, clear_status=True):
user = User.get(uid)
if not user:
print "---no user:%s" % uid
suicide_log.info("---- delete from user, uid=%s" % uid)
db_conn.execute("delete from user where id=%s", uid)
db_conn.commit()
User._clear_cache(uid)
if clear_status:
cursor = db_conn.execute("select id from status where user_id=%s", uid)
if cursor:
rows = cursor.fetchall()
for row in rows:
sid = row[0]
suicide_log.info("---- delete status text, sid=%s" % sid)
RawStatus.remove(sid)
suicide_log.info("---- delete from status, uid=" % uid)
db_conn.execute("delete from status where user_id=%s", uid)
db_conn.commit()
Status._clear_cache(uid, None)
suicide_log.info("---- delete from passwd, uid=%s" % uid)
db_conn.execute("delete from passwd where user_id=%s", uid)
suicide_log.info("---- delete from sync_task, uid=%s" % uid)
db_conn.execute("delete from sync_task where user_id=%s", uid)
suicide_log.info("---- delete from user_alias, uid=%s" % uid)
db_conn.execute("delete from user_alias where user_id=%s", uid)
db_conn.commit()
示例3: render
# 需要导入模块: from past.model.status import Status [as 别名]
# 或者: from past.model.status.Status import _clear_cache [as 别名]
def render(user, status_list, with_head=True):
if not status_list:
return
date = status_list[0].create_time.strftime("%Y年%m月")
date = date.decode("utf8")
if with_head:
_html = u"""<html> <body>
<div id="Top">
<img src="%s"/> The Past of Me | 个人杂志计划 %s CopyRight©%s
<br/>
</div>
<br/> <br/>
<div class="box">
""" % (os.path.join(app.root_path, "static/img/logo.png"),
date, user.name)
else:
_html = u"""<html> <body><div class="box">"""
from jinja2 import Environment, PackageLoader
env = Environment(loader=PackageLoader('past', 'templates'))
env.filters['wrap_long_line'] = wrap_long_line
env.filters['nl2br'] = filters.nl2br
env.filters['stream_time'] = filters.stream_time
env.filters['clear_html_element'] = clear_html_element
env.filters['isstr'] = lambda x: isinstance(x, basestring)
t = env.get_template('status.html')
m = t.module
for s in status_list:
if not s:
continue
if s.category == config.CATE_DOUBAN_STATUS:
r = m.douban_status(s, pdf=True)
elif s.category == config.CATE_SINA_STATUS:
r = m.sina_status(s, pdf=True)
elif s.category == config.CATE_TWITTER_STATUS:
r = m.twitter_status(s, pdf=True)
elif s.category == config.CATE_QQWEIBO_STATUS:
r = m.qq_weibo_status(s, pdf=True)
elif s.category == config.CATE_WORDPRESS_POST:
r = m.wordpress_status(s, pdf=True)
elif s.category == config.CATE_THEPAST_NOTE:
r = m.thepast_note_status(s, pdf=True)
elif s.category == config.CATE_RENREN_STATUS:
r = m.thepast_renren_status(s, pdf=True)
elif s.category == config.CATE_RENREN_BLOG:
r = m.thepast_renren_blog(s, pdf=True)
elif s.category == config.CATE_RENREN_PHOTO or s.category == config.CATE_RENREN_ALBUM:
r = m.thepast_renren_photo(s, pdf=True)
elif s.category == config.CATE_INSTAGRAM_STATUS:
r = m.thepast_default_status(s, pdf=True)
else:
r = ''
if not r:
continue
_html += '''<div class="cell">''' + r + '''</div>'''
Status._clear_cache(user_id = s.user_id, status_id = s.id)
_html += """</div></body></html>"""
return _html
示例4: render
# 需要导入模块: from past.model.status import Status [as 别名]
# 或者: from past.model.status.Status import _clear_cache [as 别名]
def render(user, status_list, with_head=True):
if not status_list:
return
date = status_list[0].create_time.strftime("%Y年%m月")
date = date.decode("utf8")
if with_head:
_html = u"""<html> <body>
<div id="Top">
<img src="%s"/> The Past of Me | 个人杂志计划 %s CopyRight©%s
<br/>
</div>
<br/> <br/>
<div class="box">
""" % (
os.path.join(app.root_path, "static/img/logo.png"),
date,
user.name,
)
else:
_html = u"""<html> <body><div class="box">"""
from jinja2 import Environment, PackageLoader
env = Environment(loader=PackageLoader("past", "templates"))
env.filters["wrap_long_line"] = wrap_long_line
env.filters["nl2br"] = filters.nl2br
env.filters["clear_html_element"] = clear_html_element
t = env.get_template("status.html")
m = t.module
for s in status_list:
if not s:
continue
if s.category == config.CATE_DOUBAN_STATUS:
r = m.douban_status(s, pdf=True)
elif s.category == config.CATE_SINA_STATUS:
r = m.sina_status(s, pdf=True)
elif s.category == config.CATE_TWITTER_STATUS:
r = m.twitter_status(s, pdf=True)
elif s.category == config.CATE_QQWEIBO_STATUS:
r = m.qq_weibo_status(s, pdf=True)
elif s.category == config.CATE_WORDPRESS_POST:
r = m.wordpress_status(s, pdf=True)
elif s.category == config.CATE_THEPAST_NOTE:
r = m.thepast_note_status(s, pdf=True)
else:
r = ""
if not r:
continue
_html += """<div class="cell">""" + r + """</div>"""
Status._clear_cache(user_id=s.user_id, status_id=s.id)
_html += """</div></body></html>"""
return _html
示例5: remove_status
# 需要导入模块: from past.model.status import Status [as 别名]
# 或者: from past.model.status.Status import _clear_cache [as 别名]
def remove_status(uid):
cursor = db_conn.execute("select id from status where user_id=%s", uid)
if cursor:
rows = cursor.fetchall()
for row in rows:
sid = row[0]
print "---- delete mongo text, sid=", sid
RawStatus.remove(sid)
print "---- delete from status, uid=", uid
db_conn.execute("delete from status where user_id=%s", uid)
db_conn.commit()
Status._clear_cache(uid, None)
示例6: update
# 需要导入模块: from past.model.status import Status [as 别名]
# 或者: from past.model.status.Status import _clear_cache [as 别名]
def update(self, title, content, fmt):
if title and title != self.title or fmt and fmt != self.fmt or content and content != self.content:
_fmt = fmt or self.fmt
_title = title or self.title
_content = content or self.content
db_conn.execute('''update note set title = %s, content = %s, fmt = %s where id = %s''',
(_title, _content, _fmt, self.id))
db_conn.commit()
self.flush_note()
if title != self.title:
from past.model.status import Status
Status._clear_cache(None, self.get_status_id(), None)