Beispiel #1
0
def get_record_list(array):
    """ Parse array of urlencoded records.
        Useful for turning incoming serialized data into structure usable for manipulation.
    """
    if array is None:
        return []
    return map(get_record, skytools.parse_pgarray(array))
Beispiel #2
0
def get_record_list(array):
    """ Parse array of urlencoded records.
        Useful for turning incoming serialized data into structure usable for manipulation.
    """
    if array is None:
        return []

    if not isinstance(array, list):
        array = skytools.parse_pgarray(array)
    return [get_record(el) for el in array]
Beispiel #3
0
def get_record_list(array):
    """ Parse array of urlencoded records.
        Useful for turning incoming serialized data into structure usable for manipulation.
    """
    if array is None:
        return []

    if not isinstance(array, list):
        array = skytools.parse_pgarray(array)
    return [get_record(el) for el in array]
Beispiel #4
0
 def parse_relacl(self, relacl):
     """Parse ACL to tuple of (user, acl, who)"""
     if relacl is None:
         return []
     tup_list = []
     for sacl in skytools.parse_pgarray(relacl):
         acl = skytools.parse_acl(sacl)
         if not acl:
             continue
         tup_list.append(acl)
     return tup_list
Beispiel #5
0
 def parse_relacl(self, relacl):
     """Parse ACL to tuple of (user, acl, who)"""
     if relacl is None:
         return []
     tup_list = []
     for sacl in skytools.parse_pgarray(relacl):
         acl = skytools.parse_acl(sacl)
         if not acl:
             continue
         tup_list.append(acl)
     return tup_list
Beispiel #6
0
def get_record(arg):
    """ Parse data for one urlencoded record.
        Useful for turning incoming serialized data into structure usable for manipulation.
    """
    if not arg:
        return dbdict()

    # allow array of single record
    if arg[0] in ('{', '['):
        lst = skytools.parse_pgarray(arg)
        if len(lst) != 1:
            raise ValueError('get_record() expects exactly 1 row, got %d' % len(lst))
        arg = lst[0]

    # parse record
    return dbdict(skytools.db_urldecode(arg))