예제 #1
0
파일: journal.py 프로젝트: yanqiong/kungfu
 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
예제 #2
0
파일: journal.py 프로젝트: woolf-wen/kungfu
 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
예제 #3
0
 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)