示例#1
0
    def __init__(self,
                 entry=SWORD_BOOTSTRAP,
                 dataverse=None,
                 edit_uri=None,
                 edit_media_uri=None,
                 statement_uri=None,
                 **kwargs):
        """
        Datasets must have a title, description, and author.
        This can be specified in the atom entry or as kwargs
        """
        self.dataverse = dataverse

        self.edit_uri = edit_uri
        self.edit_media_uri = edit_media_uri
        self.statement_uri = statement_uri
        self.is_deleted = False

        self._entry = etree.XML(entry) if isinstance(entry, str) else entry
        self._statement = None
        self._metadata = {}
        self._id = None

        # Updates sword entry from keyword arguments
        for key in kwargs:
            value = kwargs[key]
            if isinstance(value, list):
                for item in value:
                    add_field(self._entry, key, item, 'dcterms')
            else:
                add_field(self._entry, key, value, 'dcterms')

        self.title = get_element(self._entry, tag='title',
                                 namespace='dcterms').text
示例#2
0
    def __init__(self, entry=SWORD_BOOTSTRAP, dataverse=None, edit_uri=None,
                 edit_media_uri=None, statement_uri=None, **kwargs):
        """
        Datasets must have a title, description, and author.
        This can be specified in the atom entry or as kwargs
        """
        self.dataverse = dataverse

        self.edit_uri = edit_uri
        self.edit_media_uri = edit_media_uri
        self.statement_uri = statement_uri
        self.is_deleted = False

        self._entry = etree.XML(entry) if isinstance(entry, str) else entry
        self._statement = None
        self._metadata = {}
        self._id = None

        # Updates sword entry from keyword arguments
        for key in kwargs:
            value = kwargs[key]
            if isinstance(value, list):
                for item in value:
                    add_field(self._entry, key, item, 'dcterms')
            else:
                add_field(self._entry, key, value, 'dcterms')

        self.title = get_element(
            self._entry, tag='title', namespace='dcterms'
        ).text