• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python store.commit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vilya.libs.store.store.commit函数的典型用法代码示例。如果您正苦于以下问题:Python commit函数的具体用法?Python commit怎么用?Python commit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了commit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:000fan000,项目名称:code,代码行数:34,代码来源:update_issue.py


示例2: delete

 def delete(self):
     n = store.execute(
         "delete from tag_names "
         "where id=%s", (self.id,))
     if n:
         store.commit()
         return True
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:tag.py


示例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
开发者ID:leeccong,项目名称:code,代码行数:27,代码来源:ticket.py


示例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)
开发者ID:mozillazg,项目名称:code,代码行数:28,代码来源:project_issue.py


示例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)
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:project.py


示例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)
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:hook.py


示例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()
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:user.py


示例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)
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:project.py


示例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)
开发者ID:000fan000,项目名称:code,代码行数:32,代码来源:update_ticket.py


示例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
开发者ID:000fan000,项目名称:code,代码行数:28,代码来源:gist.py


示例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
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:gist_star.py


示例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
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:room.py


示例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
开发者ID:mozillazg,项目名称:code,代码行数:7,代码来源:linecomment.py


示例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)
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:project.py


示例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()
开发者ID:000fan000,项目名称:code,代码行数:8,代码来源:project.py


示例16: delete

 def delete(self):
     store.execute('delete from issues where id=%s', (self.id,))
     store.commit()
     mc.delete(MC_KEY_ISSUE % self.id)
     mc.delete(MC_KEY_ISSUES_IDS_BY_CREATOR_ID % self.creator_id)
     mc.delete(MC_KEY_ISSUES_IDS_BY_ASSIGNEE_ID % self.assignee_id)
     mc.delete(MC_KEY_ISSUES_DATA_BY_TARGET % (type, self.target_id))
     bdb.set(BDB_ISSUE_DESCRIPTION_KEY % self.id, '')
开发者ID:000fan000,项目名称:code,代码行数:8,代码来源:issue.py


示例17: add

 def add(cls, issue_id, user_id):
     time = datetime.now()
     participant_id = store.execute(
         "insert into issue_participants "
         "(issue_id, user_id, created_at) values (%s, %s, NULL)",
         (issue_id, user_id))
     store.commit()
     return cls(participant_id, issue_id, user_id, time)
开发者ID:000fan000,项目名称:code,代码行数:8,代码来源:issue_participant.py


示例18: delete

 def delete(self):
     bdb.delete(BDB_ISSUE_COMMENT_CONTENT_KEY % self.id)
     n = store.execute("delete from issue_comments "
                       "where id=%s", (self.id,))
     if n:
         store.commit()
         mc.delete(MC_KEY_ISSUE_COMMENTS_COUNT % self.issue_id)
         return True
开发者ID:leeccong,项目名称:code,代码行数:8,代码来源:issue_comment.py


示例19: update

 def update(self, title, description):
     store.execute("update issues "
                   "set title=%s, updated_at=null "
                   "where id=%s", (title, self.issue_id))
     store.commit()
     bdb.set(BDB_ISSUE_DESCRIPTION_KEY % self.issue_id, description)
     self.clear_cache()
     mc.delete(MC_KEY_ISSUES_DATA_BY_TARGET % (self.type, self.target_id))
开发者ID:leeccong,项目名称:code,代码行数:8,代码来源:issue.py


示例20: update_can_push

 def update_can_push(self, can_push):
     push = 1 if can_push else 0
     store.execute("update codedouban_projects "
                   "set can_push=%s "
                   "where project_id=%s",
                   (push, self.id))
     store.commit()
     self.clear_mc(self.id)
开发者ID:000fan000,项目名称:code,代码行数:8,代码来源:project.py



注:本文中的vilya.libs.store.store.commit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python store.execute函数代码示例发布时间:2022-05-26
下一篇:
Python vigra.taggedView函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap