From e5979318e2230debfd288fe65aaf21c0e326f027 Mon Sep 17 00:00:00 2001 From: Tyson Clugg Date: Fri, 10 Apr 2015 11:05:44 +1000 Subject: [PATCH] Remove unused site module. --- dddp/site.py | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 dddp/site.py diff --git a/dddp/site.py b/dddp/site.py deleted file mode 100644 index 1b9037f..0000000 --- a/dddp/site.py +++ /dev/null @@ -1,41 +0,0 @@ -"""Django DDP sites.""" -from dddp import AlreadyRegistered -from dddp.api import PubSubAPI - - -class Site(object): - - """Django DDP site class.""" - - def __init__(self): - """Django DDP site init.""" - self._registry = {} - - def register(self, endpoint_or_iterable): - """Register an API endpoint.""" - if not hasattr(endpoint_or_iterable, 'api_path'): - endpoint_or_iterable = [endpoint_or_iterable] - for endpoint in endpoint_or_iterable: - if endpoint.api_path in self._registry: - raise AlreadyRegistered( - 'API endpoint with path %r already registerd to %r' % ( - endpoint.api_path, - self._registry, - ), - ) - self._registry[endpoint.api_path] = endpoint - - def unregister(self, endpoint_or_path_or_iterable): - """Un-register an API endpoint.""" - if not hasattr(endpoint_or_iterable, 'api_path'): - endpoint_or_iterable = [endpoint_or_iterable] - for endpoint in endpoint_or_iterable: - if isinstance(endpoint, basestring): - del self._registry[endpoint.api_path] = endpoint - else: - del self._registry[endpoint.api_path] = endpoint - -site = Site() - -publications = PubSubAPI() -site.register(publications.api_endpoints)