コード例 #1
0
ファイル: unit.py プロジェクト: RedHatQE/pulp-automation
 def process_item_data(cls, data):
     '''figure out the type based on the href e.g. units/rpm -> RpmUnit, orphans/rpm -> RpmOrphan'''
     path = '.'.join(path_fields(data['_href'])[-3:-1])
     # make sure there's type to instantiate to
     # this utilizes the namespace['a.b.c....'] item locations
     assert path in cls.type_map, "path %s not found in type_map" % path
     # make sure the _href matches the type_id
     assert data['_content_type_id'] == path_fields(data['_href'])[-2], \
             "_content_type_id doesn't match href: %s" % data
     return cls.type_map[path](data)
コード例 #2
0
ファイル: unit.py プロジェクト: RedHatQE/pulp-automation
 def register(cls, unit_type):
     # register a unit_super_type.unit_type item e.g. type_map.units.rpm
     fields = path_fields(unit_type.path)
     if len(fields) <= 2:
         # probably, AbstractUnit is being registered
         return
     unit_super_type_name, unit_type_name = path_fields(unit_type.path)[1:3]
     if unit_super_type_name not in cls.type_map:
         cls.type_map[unit_super_type_name] = Namespace()
     cls.type_map[unit_super_type_name].update({unit_type_name: unit_type})
コード例 #3
0
 def path_type(cls):
     '''what type the cls.path refers to'''
     return path_fields(cls.path)[-1]
コード例 #4
0
ファイル: unit.py プロジェクト: RedHatQE/pulp-automation
 def path_type(cls):
     '''what type the cls.path refers to'''
     return path_fields(cls.path)[-1]