本文整理匯總了Python中rbtools.api.client.RBClient.get_path方法的典型用法代碼示例。如果您正苦於以下問題:Python RBClient.get_path方法的具體用法?Python RBClient.get_path怎麽用?Python RBClient.get_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rbtools.api.client.RBClient
的用法示例。
在下文中一共展示了RBClient.get_path方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ReviewBoardClient
# 需要導入模塊: from rbtools.api.client import RBClient [as 別名]
# 或者: from rbtools.api.client.RBClient import get_path [as 別名]
def ReviewBoardClient(url, username=None, password=None, apikey=None):
"""Obtain a RBClient instance via a context manager.
This exists as a context manager because of gross hacks necessary for
dealing with cookies. ``RBClient`` is coded such that it assumes it is
being used under a user account and storing cookies is always acceptable.
There is no way to disable cookie file writing or to tell it to use a file
object (such as BytesIO) as the cookies database.
We work around this deficiency by creating a temporary file and using it as
the cookies database for the lifetime of the context manager. When the
context manager exits, the temporary cookies file is deleted.
"""
fd, path = tempfile.mkstemp()
os.close(fd)
try:
if username and apikey:
rbc = RBClient(url, cookie_file=path,
transport_cls=NoCacheTransport)
login_resource = rbc.get_path(
'extensions/mozreview.extension.MozReviewExtension/'
'bugzilla-api-key-logins/')
login_resource.create(username=username, api_key=apikey)
else:
rbc = RBClient(url, username=username, password=password,
cookie_file=path, transport_cls=NoCacheTransport)
yield rbc
finally:
try:
os.unlink(path)
except Exception:
pass
示例2: ReviewBoardClient
# 需要導入模塊: from rbtools.api.client import RBClient [as 別名]
# 或者: from rbtools.api.client.RBClient import get_path [as 別名]
def ReviewBoardClient(url, username=None, password=None, apikey=None):
"""Obtain a RBClient instance."""
if username and apikey:
rbc = RBClient(url, save_cookies=False, allow_caching=False)
login_resource = rbc.get_path("extensions/mozreview.extension.MozReviewExtension/" "bugzilla-api-key-logins/")
login_resource.create(username=username, api_key=apikey)
else:
rbc = RBClient(url, username=username, password=password, save_cookies=False, allow_caching=False)
return rbc
示例3: post_reviews
# 需要導入模塊: from rbtools.api.client import RBClient [as 別名]
# 或者: from rbtools.api.client.RBClient import get_path [as 別名]
#.........這裏部分代碼省略.........
or discarding.
When publishing the squashed review request:
* A: close "discarded" because it was never used
* B: publish draft
* C: publish draft
* D: close "discarded" because it is obsolete
* set unpublished_rids to empty '[]'
* set discard_on_publish_rids to empty '[]'
When discarding the draft of a published squashed review request:
* A: close "discarded" because it was never used (so it does not appear in
the owners dashboard)
* B: close "discarded" because it was never used (so it does not appear in
the owners dashboard)
* C: DELETE the review request draft
* D: do nothing
* set unpublished_rids to empty '[]'
* set discard_on_publish_rids to empty '[]'
When discarding an unpublished squashed review request (always a close "discarded"):
* TODO Bug 1047465
"""
rbc = None
if userid and cookie:
# TODO: This is bugzilla specific code that really shouldn't be inside
# of this file. The whole bugzilla cookie resource is a hack anyways
# though so we'll deal with this for now.
rbc = RBClient(url)
login_resource = rbc.get_path(
'extensions/rbbz.extension.BugzillaExtension/'
'bugzilla-cookie-logins/')
login_resource.create(login_id=userid, login_cookie=cookie)
else:
rbc = RBClient(url, username=username, password=password)
api_root = rbc.get_root()
# This assumes that we pushed to the repository/URL that Review Board is
# configured to use. This assumption may not always hold.
repo = api_root.get_repository(repository_id=repoid)
repo_url = repo.path
# Retrieve the squashed review request or create it.
previous_commits = []
squashed_rr = None
rrs = api_root.get_review_requests(commit_id=identifier,
repository=repoid)
if rrs.total_results > 0:
squashed_rr = rrs[0]
else:
# A review request for that identifier doesn't exist - this
# is the first push to this identifier and we'll need to create
# it from scratch.
squashed_rr = rrs.create(**{
"extra_data.p2rb": "True",
"extra_data.p2rb.is_squashed": "True",
"extra_data.p2rb.identifier": identifier,
"extra_data.p2rb.discard_on_publish_rids": '[]',
"extra_data.p2rb.unpublished_rids": '[]',
"commit_id": identifier,