예제 #1
0
파일: ferry.py 프로젝트: fakegit/portia
 def onMessage(self, payload, isbinary):
     close_old_connections()
     payload = payload.decode('utf-8')
     data = json.loads(payload)
     project = data.get('project', data.get('_meta', {}).get('project'))
     storage = create_project_storage(project, author=self.user)
     projects = storage.__class__.get_projects(self.user)
     if project and str(project) not in projects:
         self.sendMessage({'status': 4004, 'message': 'Project not found'})
         return
     deferred = defer.maybeDeferred(
         wrap_callback, None, self._on_message, storage=storage, data=data)
     deferred.addCallbacks(self.sendMessage,
                           partial(self.send_error, data))
예제 #2
0
 def onMessage(self, payload, isbinary):
     close_old_connections()
     payload = payload.decode('utf-8')
     data = json.loads(payload)
     project = data.get('project', data.get('_meta', {}).get('project'))
     storage = create_project_storage(project, author=self.user)
     projects = storage.__class__.get_projects(self.user)
     if project and str(project) not in projects:
         self.sendMessage({'status': 4004, 'message': 'Project not found'})
         return
     deferred = defer.maybeDeferred(
         wrap_callback, None, self._on_message, storage=storage, data=data)
     deferred.addCallbacks(self.sendMessage,
                           partial(self.send_error, data))
예제 #3
0
 def storage(self):
     if 'project_id' in self.kwargs:
         return create_project_storage(self.kwargs['project_id'],
                                       author=self.user)
     return None
예제 #4
0
 def storage(self):
     if 'project_id' in self.kwargs:
         return create_project_storage(
             self.kwargs['project_id'], author=self.user)
     return None