def layout_dir(self, location, layout): mode = pyyjj.get_mode_name(location.mode) category = pyyjj.get_category_name(location.category) p = os.path.join(self._home, category, location.group, location.name, pyyjj.get_layout_name(layout), mode) if not os.path.exists(p): os.makedirs(p) return p
def layout_dir(self, location, layout): mode = pyyjj.get_mode_name(location.mode) category = pyyjj.get_category_name(location.category) p = os.path.join(self._home, category, location.group, location.name, pyyjj.get_layout_name(layout), mode) try: os.makedirs(p) except OSError as e: if e.errno != errno.EEXIST: raise return p
def add_location(self, location): with session_scope(self.session_factory) as session: if not session.query(Location).get(location.uid): info = { "uid": location.uid, "uname": location.uname, "mode": pyyjj.get_mode_name(location.mode), "category": pyyjj.get_category_name(location.category), "group": location.group, "name": location.name } loc_obj = Location(uid=location.uid, info=info) session.add(loc_obj)