path.py 1.63 KB
Newer Older
1
class QPath:
Gerion Entrup's avatar
Gerion Entrup committed
2
3
    """Represents a container class for special objects"""

4
5
6
    fuse_io = False

    def generic_fileattr(row):
Gerion Entrup's avatar
Gerion Entrup committed
7
8
9
10
11
12
        """Give the gid of path attribute of the requested row.

        This function returns the attributes of recording. This
        should be the common case so it is some kind of generic
        way for that.
        """
13
14
15
16
17
        return row.recording_gid, row.recording_path

    def __init__(self, path, query, functions,
                 where=[], fileattr=generic_fileattr,
                 mode=None):
Gerion Entrup's avatar
Gerion Entrup committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
        """Construct the object.

        Arguments:
        path      -- the path where the object is located in the filesystem.
        query     -- the sqlquery that has to be called to populate the last
                     element in the path.
        functions -- a Functions object that handles the creation and parsing
                     of the filename

        Keyword arguments:
        where    -- list of Where objects, that are applied to the query
                    (default [])
        fileattr -- a function that returns the attributes for gid and path of
                    a file (default generic_fileattr)
        mode     -- the mode of the directory (default None)

        The path is expected to be a string with the scheme:
        "/directory1/directory2/<directory_with_query>/<files_with_query>"
        """

38
        self.path = path
39
40
41
42
        self.query = query.apply_labels()
        self.functions = functions
        self.where = where
        self.fileattr = fileattr
43
        self.mode = mode
44

45

46
class FPath:
Gerion Entrup's avatar
Gerion Entrup committed
47
    """TODO"""
48
    fuse_io = True
49

50
51
    def get(parent, session, name):
        pass