aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMukunda Modell <mmodell@wikimedia.org>2016-07-12 19:40:14 -0500
committerMukunda Modell <mmodell@wikimedia.org>2016-07-12 19:47:33 -0500
commit4b6bff77280f2f205c7eb64b95fbcc601a52b6fe (patch)
treea851f41f25a1bae1cb232247ec9bb4699fe0283e
parente5bd9268a7eb303efa6462028e9fec11e8f2683b (diff)
Add space_phid parameter to get_taskbypolicy
The query in get_taskbypolicy should limit results to tasks in the public space. Public tasks that were created before spaces could have space_phid set to NULL.
-rwxr-xr-xwmfphablib/phabdb.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/wmfphablib/phabdb.py b/wmfphablib/phabdb.py
index deb3605..72a8f57 100755
--- a/wmfphablib/phabdb.py
+++ b/wmfphablib/phabdb.py
@@ -93,7 +93,14 @@ def get_transactionbytype(dbcon, objectPHID, type):
(objectPHID, type), limit=None)
return _
-def get_taskbypolicy(dbcon, policy='public'):
+def get_taskbypolicy(dbcon, policy='public', space_phid='PHID-SPCE-6l6g5p53yi3mypnlpxjw'):
+ """ get tasks matching a specified policy
+ :param policy: the phabricator view policy identifier
+ :param space_phid: the phid of the 'public' space. Defaults to the phid value
+ from Wikimedia's production phabricator instance.
+ """
+ # Note:
+ # space_phid is set to NULL for public tasks that were created before the spaces feature existed.
_ = dbcon.sql_x("SELECT id, \
phid, \
authorPHID, \
@@ -105,12 +112,11 @@ def get_taskbypolicy(dbcon, policy='public'):
dateModified, \
subpriority, \
points \
- FROM maniphest_task WHERE viewPolicy=%s",
-
- (policy), limit=None)
+ FROM maniphest_task WHERE viewPolicy=%s \
+ AND (spacePHID=%s OR spacePHID IS NULL)",
+ (policy, space_phid), limit=None)
return _
-
def get_user_relations_last_finish(dbcon):
""" get last finish time for update script
:param dbcon: db connector