def post(self): from cache import CacheLocation, TYPE_LOCAL_FD, TYPE_EXTERN_FD from user_sn import confirm from team import get_team_for_team_leader u = confirm(self) team = get_team_for_team_leader(u) if self.request.get("cache-key")=="MAKENEW": cl = CacheLocation() else: cl = CacheLocation.get(self.request.get("cache-key")) cl.team_responsible = team cl.description = self.request.get("description") replace_image = self.request.get("image") if replace_image != "": cl.image = replace_image if self.request.get("cache-type")=="INTERN": cl.type=TYPE_LOCAL_FD elif self.request.get("cache-type")=="EXTERN": cl.type = TYPE_EXTERN_FD else: raise Exception("I don't know the type.") cl.put() self.response.out.write("OK")
def post(self): from user_sn import confirm from team import get_team_for_team_leader from cache import TYPE_EXTERN_FD, TYPE_LOCAL_FD u = confirm(self) team = get_team_for_team_leader(u) from cache import Cache, CacheLocation type = self.request.get("type") if type=="INTERN": ctype = TYPE_LOCAL_FD elif type=="EXTERN": ctype = TYPE_EXTERN_FD where = CacheLocation.get(self.request.get("location")) c = Cache(friendlyName = self.request.get("name"),type=ctype,last_touched=u,space_left=long(self.request.get("freespace")),permanent_location=where,checked_out=True) c.put() self.response.out.write("OK")
def get(self): from cache import CacheLocation c = CacheLocation.get(self.request.get("cache")) self.response.headers["Content-Type"] = "image/jpeg" self.response.out.write(c.image)