Permalink
Browse files

Commit fewer crimes against humanity

  • Loading branch information...
1 parent 513a6f5 commit 05b652c62ef1200f3d484937f487261df3747329 @richo committed Jan 2, 2013
Showing with 4 additions and 12 deletions.
  1. +2 −6 groundstation/transfer/request.py
  2. +2 −6 groundstation/transfer/response.py
@@ -1,6 +1,7 @@
import uuid
from groundstation.proto.gizmo_pb2 import Gizmo
+import groundstation.transfer.response
from groundstation import logger
log = logger.getLogger(__name__)
@@ -9,12 +10,7 @@ class InvalidRequest(Exception):
pass
class Request(object):
- __Response = None
def __init__(self, verb, station=None, stream=None, payload=None, origin=None):
- # Cheat and load this at class definition time
- if not self.__Response:
- res = __import__("groundstation.transfer.response")
- self.__Response = res.transfer.response.Response
self.type = "REQUEST"
self.id = uuid.uuid1()
self.verb = verb
@@ -28,7 +24,7 @@ def __init__(self, verb, station=None, stream=None, payload=None, origin=None):
def _Response(self, *args, **kwargs):
kwargs['station'] = self.station
- return self.__Response(*args, **kwargs)
+ return groundstation.transfer.response.Response(*args, **kwargs)
@classmethod
@@ -1,17 +1,13 @@
from groundstation.proto.gizmo_pb2 import Gizmo
+import groundstation.transfer.request
from groundstation import logger
log = logger.getLogger(__name__)
import pygit2
class Response(object):
- __Request = None
def __init__(self, response_to, verb, payload, station=None, stream=None, origin=None):
- # Cheat and load this at class definition time
- if not self.__Request:
- req = __import__("groundstation.transfer.request")
- self.__Request = req.transfer.request.Request
self.type = "RESPONSE"
self.id = response_to
self.station = station
@@ -24,7 +20,7 @@ def __init__(self, response_to, verb, payload, station=None, stream=None, origin
def _Request(self, *args, **kwargs):
kwargs['station'] = self.station
- req = self.__Request(*args, **kwargs)
+ req = groundstation.transfer.request.Request(*args, **kwargs)
self.station.register_request(req)
return req

0 comments on commit 05b652c

Please sign in to comment.