Skip to content

Commit

Permalink
don't use class decorators, as they aren't supported in py25
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Aug 5, 2012
1 parent 7f6edbd commit 2508ef4
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions master/buildbot/www/rest.py
Expand Up @@ -26,12 +26,9 @@ class RestRootResource(resource.Resource):
version_classes = {}

@classmethod
def api_version(cls, version):
def wrap_class(version_cls):
cls.version_classes[version] = version_cls
version_cls.apiVersion = version
return version_cls
return wrap_class
def addApiVersion(cls, version, version_cls):
cls.version_classes[version] = version_cls
version_cls.apiVersion = version

def __init__(self, master):
resource.Resource.__init__(self, master)
Expand All @@ -54,7 +51,6 @@ def render(self, request):

# API version 1 was the 0.8.x status_json.py API

@RestRootResource.api_version(2)
class V2RootResource(resource.Resource):
# rather than construct the entire possible hierarchy of Rest resources,
# this is marked as a leaf node, and any remaining path items are parsed
Expand Down Expand Up @@ -197,3 +193,5 @@ def _render_links(self, obj):
if isinstance(obj, base.Link):
return "%sapi/v%d/%s" % (self.baseurl, self.apiVersion,
'/'.join(obj.path))

RestRootResource.addApiVersion(2, V2RootResource)

0 comments on commit 2508ef4

Please sign in to comment.