Esempio n. 1
0
 def get(self):
   #get the whole team's caches
   from cache import CacheLocation, Cache, TYPE_LOCAL_FD, TYPE_EXTERN_FD
   from team import get_team_for_team_leader
   from user_sn import confirm
   from cache import TYPE_LOCAL_FD
   u = confirm(self)
   team = get_team_for_team_leader(u)
   locations = CacheLocation.all().filter("team_responsible =",team).filter("type =",TYPE_LOCAL_FD).fetch(limit=1000)
   locations += CacheLocation.all().filter("team_responsible =",team).filter("type =",TYPE_EXTERN_FD).fetch(limit=1000)
   for location in locations:
       if location.type == TYPE_LOCAL_FD:
           r = "INTERN"
       elif location.type == TYPE_EXTERN_FD:
           r = "EXTERN"
       logging.info("Writing info for location %s" % location)
       self.response.out.write(r+";"+location.description+";")
       self.response.out.write("/cache/img?cache=%s" % location.key() + ";")
       self.response.out.write(location.key())
       self.response.out.write(";")
       caches = Cache.all().filter("permanent_location =",location)
       for cache in caches:
           self.response.out.write(print_cache_info(cache))
           self.response.out.write(",")
       self.response.out.write("\n")
Esempio n. 2
0
 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")
Esempio n. 3
0
 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")
Esempio n. 4
0
    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)