Loading ccserver/ccserver.py +3 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ class CCServer(object): LISTEN_BACKLOG = 5 # These tags are reserved and cannot be setted by an user: RESERVED_TAGS = ('id', 'a', 'r', 'close', 'con', 'ip') def __init__(self, conf_dir, certfile=None, keyfile=None, address='0.0.0.0', port=1984): Loading ccserver/exceptions.py +4 −0 Original line number Diff line number Diff line Loading @@ -20,3 +20,7 @@ class BadObjectError(Exception): class NotConnectedAccountError(Exception): pass class ReservedTagError(Exception): pass ccserver/handlers.py +6 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,8 @@ import inspect import logging from sjrpc.utils import RpcHandler, pure from conf import CCConf from exceptions import AlreadyRegistered, AuthenticationError, RightError from exceptions import (AlreadyRegistered, AuthenticationError, RightError, ReservedTagError) def listed(func): func.__listed__ = True Loading Loading @@ -129,7 +130,8 @@ class ClientHandler(OnlineCCHandler): ''' Add a tag to the account which match the specified query. ''' if tag_name in self._server.RESERVED_TAGS: raise ReservedTagError('Tag %r is read-only' % tag_name) objects = self._server.list(query) for obj in objects: if 'a' not in obj: Loading @@ -142,6 +144,8 @@ class ClientHandler(OnlineCCHandler): ''' Remove a tag of the account with specified login. ''' if tag_name in self._server.RESERVED_TAGS: raise ReservedTagError('Tag %r is read-only' % tag_name) objects = self._server.list(query) for obj in objects: if 'a' not in obj: Loading Loading
ccserver/ccserver.py +3 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ class CCServer(object): LISTEN_BACKLOG = 5 # These tags are reserved and cannot be setted by an user: RESERVED_TAGS = ('id', 'a', 'r', 'close', 'con', 'ip') def __init__(self, conf_dir, certfile=None, keyfile=None, address='0.0.0.0', port=1984): Loading
ccserver/exceptions.py +4 −0 Original line number Diff line number Diff line Loading @@ -20,3 +20,7 @@ class BadObjectError(Exception): class NotConnectedAccountError(Exception): pass class ReservedTagError(Exception): pass
ccserver/handlers.py +6 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,8 @@ import inspect import logging from sjrpc.utils import RpcHandler, pure from conf import CCConf from exceptions import AlreadyRegistered, AuthenticationError, RightError from exceptions import (AlreadyRegistered, AuthenticationError, RightError, ReservedTagError) def listed(func): func.__listed__ = True Loading Loading @@ -129,7 +130,8 @@ class ClientHandler(OnlineCCHandler): ''' Add a tag to the account which match the specified query. ''' if tag_name in self._server.RESERVED_TAGS: raise ReservedTagError('Tag %r is read-only' % tag_name) objects = self._server.list(query) for obj in objects: if 'a' not in obj: Loading @@ -142,6 +144,8 @@ class ClientHandler(OnlineCCHandler): ''' Remove a tag of the account with specified login. ''' if tag_name in self._server.RESERVED_TAGS: raise ReservedTagError('Tag %r is read-only' % tag_name) objects = self._server.list(query) for obj in objects: if 'a' not in obj: Loading