コード例 #1
0
ファイル: issue.py プロジェクト: publicscience/hive
 def parse_references(self, text):
     # Process references to other issues.
     referenced_issue_ids = parse_issues(text)
     for id in referenced_issue_ids:
         i = Issue.objects(id=id).first()
         # If this is a newly referenced issue,
         # create an event in the referenced issue.
         if i and i not in self.references:
             data = {
                     'project_slug': self.project.slug,
                     'referencer_id': self.id,
                     'referencer_title': self.title
             }
             self.references.append(i)
             e = event.Event(type='referenced', data=data)
             i.events.append(e)
             i.save()
     self.save()
コード例 #2
0
 def test_parse_issues_optional_full_url(self):
     text = 'hey there /something/issues/52c250f205aaef33ae1051c7/ foo'
     ids = util.parse_issues(text)
     self.assertEqual(ids, ['52c250f205aaef33ae1051c7'])
コード例 #3
0
 def test_parse_issues_multiple(self):
     text = 'hey there http://hive.publicscience.co/p/something/issues/52c250f205aaef33ae1051c7/ foo http://hive.publicscience.co/something/issues/52c350bd05aaef1c313dc2fe/'
     ids = util.parse_issues(text)
     self.assertEqual(ids, ['52c250f205aaef33ae1051c7', '52c350bd05aaef1c313dc2fe'])
コード例 #4
0
 def test_parse_issues_localhost(self):
     text = 'hey there http://localhost:5000/p/something/issues/52c250f205aaef33ae1051c7/ foo'
     ids = util.parse_issues(text)
     self.assertEqual(ids, ['52c250f205aaef33ae1051c7'])
コード例 #5
0
 def test_parse_issues(self):
     text = 'hey there http://hive.publicscience.co/p/something/issues/52c250f205aaef33ae1051c7/ foo'
     ids = util.parse_issues(text)
     self.assertEqual(ids, ['52c250f205aaef33ae1051c7'])