当前位置: 首页>>代码示例>>Python>>正文


Python store.commit函数代码示例

本文整理汇总了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()
开发者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


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