@@ -0,0 +1,1780 @@
+import abc%0A%0Afrom website.util import web_url_for%0A%0Aclass AddonSerializer(object):%0A    __metaclass__ = abc.ABCMeta%0A%0A    def __init__(self, addon_node_settings, user):%0A        self.addon_node_settings = addon_node_settings%0A        self.user = user%0A%0A    @abc.abstractproperty%0A    def serialized_urls(self):%0A        pass%0A%0A    @abc.abstractproperty%0A    def has_valid_credentials(self):%0A        pass%0A%0A    @abc.abstractproperty%0A    def node_has_auth(self):%0A        pass%0A%0A    @abc.abstractproperty%0A    def user_has_auth(self):%0A        pass%0A%0A    @abc.abstractproperty%0A    def user_is_owner(self):%0A        pass%0A%0A    @abc.abstractproperty%0A    def credentials_owner(self):%0A        pass%0A%0A    @property%0A    def serialized_settings(self):%0A%0A        node_has_auth = self.node_has_auth%0A        result = %7B%0A            'nodeHasAuth': node_has_auth,%0A            'userHasAuth': self.user_has_auth,%0A            'userIsOwner': self.user_is_owner,%0A            'validCredentials': self.has_valid_credentials,%0A            'urls': self.serialized_urls,%0A        %7D%0A%0A        if node_has_auth:%0A            owner = self.credentials_owner%0A            if owner:%0A                result%5B'urls'%5D%5B'owner'%5D = web_url_for('profile_view_id',%0A                                                  uid=owner._primary_key)%0A                result%5B'ownerName'%5D = owner.fullname%0A%0A        return result%0A%0Aclass StorageAddonSerializer(AddonSerializer):%0A    __metaclass__ = abc.ABCMeta%0A%0A    @abc.abstractproperty%0A    def serialized_folder(self):%0A        pass%0A%0A    @property%0A    def serialized_settings(self):%0A%0A        result = super(StorageAddonSerializer, self).serialized_settings%0A        result%5B'folder'%5D = self.serialized_folder%0A        return result%0A%0Aclass CitationsAddonSerializer(AddonSerializer):%0A    __metaclass__ = abc.ABCMeta%0A

Add base class for serializing addons.