示例#1
0
 def get(self, model, key):
   if model in ['Collection']:
     collection = Collection.get(key)
     self.response.headers['Content-Type'] = "application/vnd.oasis.opendocument.spreadsheet"
     self.response.headers['Content-Disposition'] = "filename=Survival-Kit-Orders_%s.ods" % collection.created.strftime("%Y-%m-%d")
     self.response.out.write(collection.sheet())
   else:
     self.error(404)
示例#2
0
 def get(self, model, key):
     if model in ["Collection"]:
         collection = Collection.get(key)
         self.response.headers["Content-Type"] = "application/vnd.oasis.opendocument.spreadsheet"
         self.response.headers[
             "Content-Disposition"
         ] = "filename=Survival-Kit-Orders_%s.ods" % collection.created.strftime("%Y-%m-%d")
         self.response.out.write(collection.sheet())
     else:
         self.error(404)
示例#3
0
  def render_form(self, collection=None):
    context = simpleTALES.Context(allowPythonPath=True)

    context.addGlobal("title", "Manage Survival KIT Orders")
    context.addGlobal("root", '/manage/')
    context.addGlobal("orders", Order.uncollected())
    context.addGlobal("download", collection)
    context.addGlobal("collections", Collection.all().order('created'))
    context.addGlobal("release_dates", ReleaseDate.all().order('date'))
    context.addGlobal("exchange_types", ExchangeType.all().order('type'))   
    context.addGlobal("instructions", Instruction.all().order('topic'))

    return self.render_html("secretary.pt", self.macros_from("master.pt", context))
示例#4
0
    def render_form(self, collection=None):
        context = simpleTALES.Context(allowPythonPath=True)

        context.addGlobal("title", "Manage Survival KIT Orders")
        context.addGlobal("root", "/manage/")
        context.addGlobal("orders", Order.uncollected())
        context.addGlobal("download", collection)
        context.addGlobal("collections", Collection.all().order("created"))
        context.addGlobal("release_dates", ReleaseDate.all().order("date"))
        context.addGlobal("exchange_types", ExchangeType.all().order("type"))
        context.addGlobal("instructions", Instruction.all().order("topic"))

        return self.render_html("secretary.pt", self.macros_from("master.pt", context))
示例#5
0
 def get(self, model, key=None):
   if model in ['Collection']:
     collection = Collection.get(key)
     for order in collection.order_set:
       for kit in order.kit_set:
         kit.delete()
       order.delete()
     collection.delete()
     self.redirect("/manage/")
   elif model in ['ReleaseDate', 'ExchangeType', 'Instruction']:
     self.destroy(key or self.request.get_all('key'))
     self.redirect("/manage/")
   else:
     self.error(404)
示例#6
0
 def get(self, model, key=None):
     if model in ["Collection"]:
         collection = Collection.get(key)
         for order in collection.order_set:
             for kit in order.kit_set:
                 kit.delete()
             order.delete()
         collection.delete()
         self.redirect("/manage/")
     elif model in ["ReleaseDate", "ExchangeType", "Instruction"]:
         self.destroy(key or self.request.get_all("key"))
         self.redirect("/manage/")
     else:
         self.error(404)