本文整理汇总了Python中trac.versioncontrol.RepositoryManager.get_repository_id方法的典型用法代码示例。如果您正苦于以下问题:Python RepositoryManager.get_repository_id方法的具体用法?Python RepositoryManager.get_repository_id怎么用?Python RepositoryManager.get_repository_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.versioncontrol.RepositoryManager
的用法示例。
在下文中一共展示了RepositoryManager.get_repository_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: unlink_product
# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_repository_id [as 别名]
def unlink_product(self, reponame):
if not isinstance(self.env, ProductEnvironment):
return
rm = RepositoryManager(self.env.parent)
repoid = rm.get_repository_id(reponame)
links = self._get_repository_links(repoid)
links.remove(self.env.product.prefix)
with self.env.db_direct_transaction as db:
if len(links) > 0:
db("""UPDATE repository SET value=%s WHERE id=%s
AND name='product'""", (','.join(links), repoid))
else:
db("""DELETE FROM repository WHERE id=%s AND name='product'
AND value='%s'""" % (repoid, self.env.product.prefix))
示例2: link_product
# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_repository_id [as 别名]
def link_product(self, reponame):
if not isinstance(self.env, ProductEnvironment):
return
rm = RepositoryManager(self.env.parent)
repoid = rm.get_repository_id(reponame)
links = self._get_repository_links(repoid)
with self.env.db_direct_transaction as db:
if links:
links.append(self.env.product.prefix)
db("""UPDATE repository SET value=%s WHERE id=%s
AND name='product'""", (','.join(links), repoid))
else:
db("""INSERT INTO repository (id, name, value)
VALUES(%s, 'product', '%s')""" %
(repoid, self.env.product.prefix))