def to_representation(self, data, envelope='data'): if isinstance(data, AbstractNode): if data.is_registration: serializer = RegistrationSerializer(data, context=self.context) return RegistrationSerializer.to_representation( serializer, data) serializer = NodeSerializer(data, context=self.context) return NodeSerializer.to_representation(serializer, data) if isinstance(data, OSFUser): serializer = UserSerializer(data, context=self.context) return UserSerializer.to_representation(serializer, data) if isinstance(data, BaseFileNode): serializer = FileSerializer(data, context=self.context) return FileSerializer.to_representation(serializer, data) if isinstance(data, Institution): serializer = InstitutionSerializer(data, context=self.context) return InstitutionSerializer.to_representation(serializer, data) if isinstance(data, CollectionSubmission): serializer = CollectionSubmissionSerializer(data, context=self.context) return CollectionSubmissionSerializer.to_representation( serializer, data) return None
def to_representation(self, data, envelope='data'): if isinstance(data, AbstractNode): if data.is_registration: serializer = RegistrationSerializer(data, context=self.context) return RegistrationSerializer.to_representation(serializer, data) serializer = NodeSerializer(data, context=self.context) return NodeSerializer.to_representation(serializer, data) if isinstance(data, OSFUser): serializer = UserSerializer(data, context=self.context) return UserSerializer.to_representation(serializer, data) if isinstance(data, BaseFileNode): serializer = FileSerializer(data, context=self.context) return FileSerializer.to_representation(serializer, data) if isinstance(data, Institution): serializer = InstitutionSerializer(data, context=self.context) return InstitutionSerializer.to_representation(serializer, data) if isinstance(data, CollectedGuidMetadata): serializer = CollectedMetaSerializer(data, context=self.context) return CollectedMetaSerializer.to_representation(serializer, data) return None
def to_representation(self, data, envelope="data"): if isinstance(data, Node): if data.is_registration: serializer = RegistrationSerializer(data, context=self.context) return RegistrationSerializer.to_representation(serializer, data) serializer = NodeSerializer(data, context=self.context) return NodeSerializer.to_representation(serializer, data) if isinstance(data, User): serializer = UserSerializer(data, context=self.context) return UserSerializer.to_representation(serializer, data) if isinstance(data, FileNode): serializer = FileSerializer(data, context=self.context) return FileSerializer.to_representation(serializer, data) return None
def to_representation(self, data, envelope='data'): if isinstance(data, AbstractNode): if data.is_registration: serializer = RegistrationSerializer(data, context=self.context) return RegistrationSerializer.to_representation( serializer, data) serializer = NodeSerializer(data, context=self.context) return NodeSerializer.to_representation(serializer, data) if isinstance(data, User): serializer = UserSerializer(data, context=self.context) return UserSerializer.to_representation(serializer, data) if isinstance(data, FileNode): serializer = FileSerializer(data, context=self.context) return FileSerializer.to_representation(serializer, data) return None