Exemplo n.º 1
0
 def __init__(self, db_obj, row):
     self.db_obj = db_obj
     self.id = row[File.cols['id']]
     self.name = row[File.cols['name']]
     user_id = row[File.cols['owner_id']]
     self.owner = User(self.db_obj, user_id)
     self.data_key = row[File.cols['data_key']]
     ot = row[File.cols['object_type']]
     self.object_type = pynimbusauthz.reverse_lookup_type(pynimbusauthz.object_types, ot)
     file_id = row[File.cols['parent_id']]
     if file_id == None:
         self.parent = None
     else:
         self.parent = File.get_file_from_db_id(db_obj, file_id)
     self.md5sum = row[File.cols['md5sum']]
     self.object_size = row[File.cols['object_size']]
     ctm = row[File.cols['creation_time']]
     if ctm != None:
         ctm = str(ctm)
         ndx = ctm.rfind(".")
         if ndx > 0:
             ctm = ctm[:ndx]
         self.creation_time = time.strptime(ctm, "%Y-%m-%d %H:%M:%S")
     else:
         self.creation_time = None
Exemplo n.º 2
0
 def get_type(self):
     return pynimbusauthz.reverse_lookup_type(pynimbusauthz.alias_types, self.alias_type)