Ejemplo n.º 1
0
    def __init__(self, path_abs, id=None, identifier=None):
        """
        >>> c = Collection('/tmp/ddr-testing-123')
        >>> c.id
        'ddr-testing-123'
        >>> c.ead_path_rel
        'ead.xml'
        >>> c.ead_path
        '/tmp/ddr-testing-123/ead.xml'
        >>> c.json_path_rel
        'collection.json'
        >>> c.json_path
        '/tmp/ddr-testing-123/collection.json'
        """
        path_abs = os.path.normpath(path_abs)
        if identifier:
            i = identifier
        else:
            i = Identifier(path=path_abs)
        self.identifier = i

        self.id = i.id
        self.idparts = i.parts.values()

        self.path_abs = path_abs
        self.path = path_abs

        self.root = os.path.split(self.path)[0]
        self.json_path = i.path_abs('json')
        self.git_path = i.path_abs('git')
        self.gitignore_path = i.path_abs('gitignore')
        self.annex_path = i.path_abs('annex')
        self.changelog_path = i.path_abs('changelog')
        self.control_path = i.path_abs('control')
        self.ead_path = i.path_abs('ead')
        self.lock_path = i.path_abs('lock')
        self.files_path = i.path_abs('files')

        self.path_rel = i.path_rel()
        self.json_path_rel = i.path_rel('json')
        self.git_path_rel = i.path_rel('git')
        self.gitignore_path_rel = i.path_rel('gitignore')
        self.annex_path_rel = i.path_rel('annex')
        self.changelog_path_rel = i.path_rel('changelog')
        self.control_path_rel = i.path_rel('control')
        self.ead_path_rel = i.path_rel('ead')
        self.files_path_rel = i.path_rel('files')

        self.git_url = '{}:{}'.format(config.GITOLITE, self.id)
Ejemplo n.º 2
0
    def __init__(self, path_abs, id=None, identifier=None):
        path_abs = os.path.normpath(path_abs)
        if identifier:
            i = identifier
        else:
            i = Identifier(path=path_abs)
        self.identifier = i

        self.id = i.id
        self.idparts = list(i.parts.values())

        self.collection_id = i.collection_id()
        self.parent_id = i.parent_id()

        self.path_abs = path_abs
        self.path = path_abs
        self.collection_path = i.collection_path()
        self.parent_path = i.parent_path()

        self.root = os.path.dirname(self.parent_path)
        self.json_path = i.path_abs('json')
        self.changelog_path = i.path_abs('changelog')
        self.control_path = i.path_abs('control')
        self.mets_path = i.path_abs('mets')
        self.lock_path = i.path_abs('lock')
        self.files_path = i.path_abs('files')

        self.path_rel = i.path_rel()
        self.json_path_rel = i.path_rel('json')
        self.changelog_path_rel = i.path_rel('changelog')
        self.control_path_rel = i.path_rel('control')
        self.mets_path_rel = i.path_rel('mets')
        self.files_path_rel = i.path_rel('files')
Ejemplo n.º 3
0
 def __init__( self, path_abs, id=None, identifier=None ):
     path_abs = os.path.normpath(path_abs)
     if identifier:
         i = identifier
     else:
         i = Identifier(path=path_abs)
     self.identifier = i
     
     self.id = i.id
     self.idparts = i.parts.values()
     
     self.collection_id = i.collection_id()
     self.parent_id = i.parent_id()
     
     self.path_abs = path_abs
     self.path = path_abs
     self.collection_path = i.collection_path()
     self.parent_path = i.parent_path()
     
     self.root = os.path.dirname(self.parent_path)
     self.json_path = i.path_abs('json')
     self.changelog_path = i.path_abs('changelog')
     self.control_path = i.path_abs('control')
     self.mets_path = i.path_abs('mets')
     self.lock_path = i.path_abs('lock')
     self.files_path = i.path_abs('files')
     
     self.path_rel = i.path_rel()
     self.json_path_rel = i.path_rel('json')
     self.changelog_path_rel = i.path_rel('changelog')
     self.control_path_rel = i.path_rel('control')
     self.mets_path_rel = i.path_rel('mets')
     self.files_path_rel = i.path_rel('files')