summaryrefslogtreecommitdiff
path: root/pygerrit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2013-09-11 09:43:19 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2013-09-11 14:08:23 +0900
commit1b646c2b3ada19e3b96f36dd2eef261104917c31 (patch)
tree9347bc553e55dd7169c3f5c715a15252064c1de5 /pygerrit
parent76590aa4080d125084a110a496505d485ef75ceb (diff)
downloadpygerrit-1b646c2b3ada19e3b96f36dd2eef261104917c31.tar.gz
Fix #4: Keep event's raw json data in the event object
If any future versions of Gerrit add data elements that are not encapsulated by the event class, clients will be able to access them via the raw json data. Change-Id: Ia689acb808f9d200f53b86c60f024e865dd12a18
Diffstat (limited to 'pygerrit')
-rw-r--r--pygerrit/events.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/pygerrit/events.py b/pygerrit/events.py
index e563a7a..76f1c86 100644
--- a/pygerrit/events.py
+++ b/pygerrit/events.py
@@ -78,8 +78,8 @@ class GerritEvent(object):
""" Gerrit event base class. """
- def __init__(self):
- pass
+ def __init__(self, json_data):
+ self.json = json_data
@GerritEventFactory.register("patchset-created")
@@ -88,7 +88,7 @@ class PatchsetCreatedEvent(GerritEvent):
""" Gerrit "patchset-created" event. """
def __init__(self, json_data):
- super(PatchsetCreatedEvent, self).__init__()
+ super(PatchsetCreatedEvent, self).__init__(json_data)
try:
self.change = Change(json_data["change"])
self.patchset = Patchset(json_data["patchSet"])
@@ -108,7 +108,7 @@ class DraftPublishedEvent(GerritEvent):
""" Gerrit "draft-published" event. """
def __init__(self, json_data):
- super(DraftPublishedEvent, self).__init__()
+ super(DraftPublishedEvent, self).__init__(json_data)
try:
self.change = Change(json_data["change"])
self.patchset = Patchset(json_data["patchSet"])
@@ -128,7 +128,7 @@ class CommentAddedEvent(GerritEvent):
""" Gerrit "comment-added" event. """
def __init__(self, json_data):
- super(CommentAddedEvent, self).__init__()
+ super(CommentAddedEvent, self).__init__(json_data)
try:
self.change = Change(json_data["change"])
self.patchset = Patchset(json_data["patchSet"])
@@ -153,7 +153,7 @@ class ChangeMergedEvent(GerritEvent):
""" Gerrit "change-merged" event. """
def __init__(self, json_data):
- super(ChangeMergedEvent, self).__init__()
+ super(ChangeMergedEvent, self).__init__(json_data)
try:
self.change = Change(json_data["change"])
self.patchset = Patchset(json_data["patchSet"])
@@ -173,7 +173,7 @@ class ChangeAbandonedEvent(GerritEvent):
""" Gerrit "change-abandoned" event. """
def __init__(self, json_data):
- super(ChangeAbandonedEvent, self).__init__()
+ super(ChangeAbandonedEvent, self).__init__(json_data)
try:
self.change = Change(json_data["change"])
self.patchset = Patchset.from_json(json_data)
@@ -194,7 +194,7 @@ class ChangeRestoredEvent(GerritEvent):
""" Gerrit "change-restored" event. """
def __init__(self, json_data):
- super(ChangeRestoredEvent, self).__init__()
+ super(ChangeRestoredEvent, self).__init__(json_data)
try:
self.change = Change(json_data["change"])
self.patchset = Patchset.from_json(json_data)
@@ -215,7 +215,7 @@ class RefUpdatedEvent(GerritEvent):
""" Gerrit "ref-updated" event. """
def __init__(self, json_data):
- super(RefUpdatedEvent, self).__init__()
+ super(RefUpdatedEvent, self).__init__(json_data)
try:
self.ref_update = RefUpdate(json_data["refUpdate"])
self.submitter = Account.from_json(json_data, "submitter")