本文整理汇总了Python中vilya.libs.store.store.commit函数的典型用法代码示例。如果您正苦于以下问题:Python commit函数的具体用法?Python commit怎么用?Python commit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了commit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
rs = store.execute("select id, type "
"from issues "
"where type='project'")
for r in rs:
id, _ = r
rs1 = store.execute("select id, project_id, issue_id "
"from project_issues "
"where issue_id=%s",
id)
if rs1 and rs1[0]:
_, target_id, _ = rs1[0]
store.execute("update issues "
"set target_id=%s "
"where id=%s",
(target_id, id))
store.commit()
rs = store.execute("select id, type "
"from issues "
"where type='team'")
for r in rs:
id, _ = r
rs1 = store.execute("select id, team_id, issue_id "
"from team_issues "
"where issue_id=%s",
id)
if rs1 and rs1[0]:
_, target_id, _ = rs1[0]
store.execute("update issues "
"set target_id=%s "
"where id=%s",
(target_id, id))
store.commit()
示例2: delete
def delete(self):
n = store.execute(
"delete from tag_names "
"where id=%s", (self.id,))
if n:
store.commit()
return True
示例3: add
def add(cls, ticket_id, content, path, position,
old, new, from_ref, author, new_path=None):
# FIXME: mysql里的content是废的啊,是历史原因么?
line_mark = str(old) + '|' + str(new)
id = store.execute("insert into codedouban_ticket_codereview "
"(ticket_id, content, path, position, line_mark, "
"from_ref, author, new_path) "
"values (%s, %s, %s, %s, %s, %s, %s, %s)",
(ticket_id, content, path, position, line_mark,
from_ref, author, new_path))
if not id:
store.rollback()
raise Exception("Unable to add")
store.commit()
bdb.set(BDB_TICKET_LINECOMMENT_CONTENT_KEY % id, content)
comment = cls.get(id)
ticket = Ticket.get(ticket_id)
# TODO: 重构feed之后取消signal发送
codereview_signal.send(comment, content=content,
ticket=Ticket.get(ticket_id),
author=author, comment=comment)
dispatch('codereview', data={
'comment': comment,
'ticket': ticket,
'sender': author,
})
return comment
示例4: add
def add(
cls,
title,
description,
creator,
number=None,
team=None,
project=None,
assignee=None,
closer=None,
created_at=None,
updated_at=None,
closed_at=None,
):
issue = Issue.add(
title, description, creator, assignee=assignee, closer=closer, type=cls.target_type, target_id=project
)
if issue and project:
number = PICounter.incr(project, number)
store.execute(
"insert into project_issues (project_id, issue_id, number) " "values (%s, %s, %s) ",
(project, issue.id, number),
)
store.commit()
mc.delete(MC_KEY_PROJECT_ISSUE_CREATOR_N % (project, creator, "open"))
mc.delete(MC_KEY_PROJECT_ISSUE_CREATOR_N % (project, creator, "closed"))
cls._clean_cache(project)
return Issue.get_cached_issue(issue.id)
示例5: update_summary
def update_summary(self, summary):
store.execute("update codedouban_projects "
"set summary=%s "
"where project_id=%s",
(summary, self.id))
store.commit()
self.clear_mc(self.id)
示例6: add
def add(cls, url, project_id):
hook_id = store.execute("insert into codedouban_hooks "
"(project_id, url) values "
"(%s, %s)",
(project_id, url))
store.commit()
return cls(hook_id, url, project_id)
示例7: add
def add(cls, name, followed_user_name):
time = datetime.now()
store.execute('insert into follow_relationship '
'(user_name, followed_user_name, time) '
'values (%s, %s, %s)',
(name, followed_user_name, time))
store.commit()
示例8: update_intern_banned
def update_intern_banned(self, banned):
store.execute("update codedouban_projects "
"set intern_banned=%s "
"where project_id=%s",
(banned, self.id))
store.commit()
self.clear_mc(self.id)
示例9: main
def main():
rs = store.execute("select id "
"from codedouban_ticket")
for r in rs:
id, = r
ticket = Ticket.get(id)
# update merge
pullreq = PullRequest.get_by_ticket(ticket)
author = pullreq.merge_by or pullreq.to_proj.owner_id
time = pullreq.merge_time
ticket_id = ticket.id
id = 0
if not get_node(author, TICKET_NODE_TYPE_MERGE, id, ticket_id, time) and time:
print id, author, time, ticket_id
store.execute("insert into ticket_nodes "
"(author, type, type_id, ticket_id, created_at) "
"value (%s, %s, %s, %s, %s)",
(author, TICKET_NODE_TYPE_MERGE, id, ticket_id, time))
store.commit()
# update close
author = ticket.close_by or ticket.author
time = ticket.closed
ticket_id = ticket.id
id = 0
if not get_node(author, TICKET_NODE_TYPE_CLOSE, id, ticket_id, time) and time:
print id, author, time, ticket_id
store.execute("insert into ticket_nodes "
"(author, type, type_id, ticket_id, created_at) "
"value (%s, %s, %s, %s, %s)",
(author, TICKET_NODE_TYPE_CLOSE, id, ticket_id, time))
store.commit()
print "update %s close & merge pulls" % len(rs)
示例10: add
def add(cls, description, owner_id, is_public, gist_names=[],
gist_contents=[], fork_from=None):
now = datetime.now()
if fork_from:
name = cls.get(fork_from).name
id = store.execute(
"insert into gists "
"(`name`, `description`, `owner_id`, `created_at`, `fork_from`) " # noqa
"values (%s, %s, %s, %s, %s)",
(name, description, owner_id, now, fork_from))
store.commit()
gist = cls.get(id)
fork_from = cls.get(fork_from)
fork_from.fork_repo(gist)
gist_forked_signal.send(gist, gist_id=gist.id)
else:
name = cls._get_name(names=gist_names)
id = store.execute(
"insert into gists "
"(`name`, `description`, `owner_id`, `is_public`, `created_at`) " # noqa
"values (%s, %s, %s, %s, %s)",
(name, description, owner_id, is_public, now))
store.commit()
gist = cls.get(id)
gist.create_repo()
gist._commit_all_files(gist_names, gist_contents, create=True)
gist_created_signal.send(gist, gist_id=gist.id)
return gist
示例11: add
def add(cls, gist_id, user_id):
id = store.execute("insert into gist_stars (`gist_id`, `user_id`)"
"values (%s, %s)", (gist_id, user_id))
store.commit()
gs = cls.get(id)
gist_starred_signal.send(gs, gist_id=gist_id, author=user_id)
return True
示例12: delete
def delete(cls, name):
rs = store.execute("delete from chat_rooms "
"where name=%s", (name,))
if rs:
store.commit()
return True
return False
示例13: delete
def delete(self):
n = store.execute("delete from codedouban_linecomments_v2 "
"where id = %s", (self.id,))
if n:
store.commit()
return True
return False
示例14: update_product
def update_product(self, product):
store.execute("update codedouban_projects "
"set product=%s "
"where project_id=%s",
(product, self.id))
store.commit()
self.clear_mc(self.id)
示例15: add_committer
def add_committer(cls, proj_id, user_id):
try:
store.execute("insert into codedouban_committers "
"(project_id, user_id) values (%s, %s)",
(proj_id, user_id))
except IntegrityError:
return None
store.commit()