Exemple #1
0
  def post(self, domain_name):
    domain = get_domain_or_404(domain_name, allow_none=True)
    if not domain:
      domain = Domain(name=domain_name, clickcount=0, money=0., status=0.)
    # example content:
    # "firstvisit":"center","secondvisit":"center","heading":"Vielen Dank!","subheading":"Dein Klick auf domain.hiv hat soeben einen Gegenwert von 1 ct ausgelöst.","claim":"Wir sind Teil der Bewegung","about":"Über dotHIV","vote":"Vote","activated":"Bisher aktiviert:","currency":"€","corresponding":"entspricht","clicks":"Klicks"
    domain.content = self.request.body
    domain.put()

    self.response.headers['Content-Type'] = 'text/plain'
    self.response.set_status(204)
    def post(self, domain_name):
        domain = get_domain_or_404(domain_name, allow_none=True)
        if not domain:
            domain = Domain(name=domain_name, clickcount=0)
        data = self.request.body.strip()
        config = json.decode(data) if len(data) > 0 else {}
        config['__locales'] = []
        if 'strings' in config:
            for locale in config['strings']:
                config['__locales'].append(locale)
        domain.content = json.encode(config)

        # Redirects
        domain.redirect_enabled = False
        domain.redirect_url = None
        if 'redirect_url' in config:
            domain.redirect_enabled = True
            domain.redirect_url = config['redirect_url']

        domain.put()
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.set_status(204)