Berker Peksag added the comment:
The attached patch should fix the empty date issue.
_______________________________________________________
PSF Meta Tracker <metatrac...@psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue611>
_______________________________________________________
diff --git a/roundup/github.py b/roundup/github.py
--- a/roundup/github.py
+++ b/roundup/github.py
@@ -1,15 +1,16 @@
import hashlib
import hmac
import json
import re
import os
import logging
+from roundup.date import Date
from roundup.exceptions import Unauthorised, MethodNotAllowed, \
UnsupportedMediaType, Reject
if hasattr(hmac, 'compare_digest'):
compare_digest = hmac.compare_digest
else:
def compare_digest(a, b):
return a == b
@@ -350,17 +351,20 @@ class Push(Event):
# close the issue
messages[issue_id] = (curr_msg + u'\n' + msg, curr_close|close)
if not messages:
return
for issue_id, (msg, close) in messages.iteritems():
# add comments to appropriate issues...
id = issue_id.encode('utf-8')
issue_msgs = self.db.issue.get(id, 'messages')
- newmsg = self.db.msg.create(content=msg.encode('utf-8'),
author=self.db.getuid())
+ newmsg = self.db.msg.create(
+ content=msg.encode('utf-8'), author=self.db.getuid(),
+ date=Date('.'),
+ )
issue_msgs.append(newmsg)
self.db.issue.set(id, messages=issue_msgs)
# ... and close, if needed
if close:
self.db.issue.set(id,
status=self.db.status.lookup('closed'))
self.db.issue.set(id,
resolution=self.db.resolution.lookup('fixed'))
diff --git a/test/test_github.py b/test/test_github.py
--- a/test/test_github.py
+++ b/test/test_github.py
@@ -1,16 +1,17 @@
import unittest
import os
import db_test_base
import cgi
from BaseHTTPServer import BaseHTTPRequestHandler
from StringIO import StringIO
from roundup.cgi import client
from roundup.backends import list_backends
+from roundup.date import Date
from roundup.github import GitHubHandler
from roundup.exceptions import *
NEEDS_INSTANCE = 1
class HTTPRequest(BaseHTTPRequestHandler):
def __init__(self, filename):
@@ -303,16 +304,18 @@ class TestCase(unittest.TestCase):
msgs = self.db.issue.get('1', 'messages')
self.assertEqual(len(msgs), 1)
content = self.db.msg.get(msgs[0], 'content')
self.assertIn("""New changeset
65c3a074262662a2c55109ff9a2456ee7647fcc9 by Maciej Szulik in branch 'test1':
#1: fix tests.
https://github.com/python/cpython/commit/65c3a074262662a2c55109ff9a2456ee7647fcc9
""",
content)
+ self.assertIsInstance(self.db.msg.get(msgs[0], 'creation'), Date)
+ self.assertIsInstance(self.db.msg.get(msgs[0], 'date'), Date)
# issue status
status = self.db.issue.get('1', 'status')
self.assertNotEqual(self.db.status.get(status, 'name'), 'closed')
self.assertIsNone(self.db.issue.get('1', 'resolution'))
self.assertIsNone(self.db.issue.get('1', 'stage'))
def testPushEventAddsCommentAndClose(self):
dummy_client = self._make_client('pushevent1.txt')
_______________________________________________
Tracker-discuss mailing list
Tracker-discuss@python.org
https://mail.python.org/mailman/listinfo/tracker-discuss
Code of Conduct: https://www.python.org/psf/codeofconduct/