예제 #1
0
 def _update_map(self, map, name=None, filepath=None):
     """ Delete a mapfile entry from database. """
     if name:
         map.name = name
     if filepath:
         map.filepath = filepath
     Session.commit()
예제 #2
0
 def _new_map_from_user(self, user, name, filepath):
     """ Create a new mapfile entry in database. """
     map = Map(name, filepath)
     map.user = Session.query(User).filter(User.login==user).one()
     Session.add(map)
     Session.commit()
     return map
예제 #3
0
파일: mapfiles.py 프로젝트: yjacolin/Studio
 def _new_map_from_user(self, user, name, filepath):
     """ Create a new mapfile entry in database. """
     map = Map(name, filepath)
     map.user = Session.query(User).filter(User.login == user).one()
     Session.add(map)
     Session.commit()
     return map
예제 #4
0
파일: mapfiles.py 프로젝트: yjacolin/Studio
 def _update_map(self, map, name=None, filepath=None):
     """ Delete a mapfile entry from database. """
     if name:
         map.name = name
     if filepath:
         map.filepath = filepath
     Session.commit()
예제 #5
0
 def _delete_map_from_user_by_id(self, user, map_id):
     """ Delete a mapfile entry from database. """
     map = self._get_map_from_user_by_id(user, map_id)
     if map is None:
         return None
     Session.delete(map)
     Session.commit()
     return map
예제 #6
0
파일: mapfiles.py 프로젝트: yjacolin/Studio
 def _delete_map_from_user_by_id(self, user, map_id):
     """ Delete a mapfile entry from database. """
     map = self._get_map_from_user_by_id(user, map_id)
     if map is None:
         return None
     Session.delete(map)
     Session.commit()
     return map
예제 #7
0
 def _get_map_from_user_by_id(self, user, map_id):
     """ Get a mapfile owned by a user from the database by
         map_id. """
     req = Session.query(Map).select_from(join(Map, User))
     try:
         return req.filter(and_(User.login==user, Map.id==map_id)).one()
     except Exception, e:
         return None
예제 #8
0
파일: mapfiles.py 프로젝트: yjacolin/Studio
 def _get_map_from_user_by_id(self, user, map_id):
     """ Get a mapfile owned by a user from the database by
         map_id. """
     req = Session.query(Map).select_from(join(Map, User))
     try:
         return req.filter(and_(User.login == user, Map.id == map_id)).one()
     except Exception, e:
         return None
예제 #9
0
 def _get_maps_from_user(self, user):
     """ Get mapfiles owned by a user from the database. """
     req = Session.query(Map).select_from(join(Map, User))
     return req.filter(User.login==user).all()
예제 #10
0
 def _get_datastore_by_id(self, datastore_id):
     """ Get from the database the datastore identifier by
         datastore_id. """
     return Session.query(model.DataStore).get(datastore_id)
예제 #11
0
파일: mapfiles.py 프로젝트: yjacolin/Studio
 def _get_maps_from_user(self, user):
     """ Get mapfiles owned by a user from the database. """
     req = Session.query(Map).select_from(join(Map, User))
     return req.filter(User.login == user).all()