mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-05 11:48:33 +08:00
A useful utility classmethod.
This commit is contained in:
@@ -121,6 +121,12 @@ class ModuleBuild(Base):
|
||||
return BUILD_STATES[field]
|
||||
raise ValueError("%s: %s, not in %r" % (key, field, BUILD_STATES))
|
||||
|
||||
@classmethod
|
||||
def from_fedmsg(cls, session, msg):
|
||||
if '.module.' not in msg['topic']:
|
||||
raise ValueError("%r is not a module message." % msg['topic'])
|
||||
return session.query(cls).filter_by(cls.id==msg['msg']['id'])
|
||||
|
||||
def json(self):
|
||||
return {
|
||||
'id': self.id,
|
||||
|
||||
Reference in New Issue
Block a user