예제 #1
0
def img_json(ad):
        return simplejson.dumps({
            'name':ad.name,
            'target_url':ad.target_url,
            'mimetype':ad.mimetype,
            'img_path':webapp2.uri_for('image-server',img_advert_id=ad.key().id())
        })
예제 #2
0
 def post(self, campaign_id):
     user = users.get_current_user()
     if not user:
         return self.redirect(users.create_login_url(self.request.uri))
     name = self.request.get('name', None)
     target_url = self.request.get('target_url', None)
     priority = self.request.get('priority', None)
     img = self.request.POST['img']
     alt_text = self.request.get('alt_text', None)
     title_text = self.request.get('title_text', None)
     if not target_url or not img.value:
         return self.get(campaign_id, [
             'Faltan campos obligatorios',
         ])
     campaign = Campaign.get_by_id(int(campaign_id))
     ad = ImgAdvert(name=name,
                    target_url=target_url,
                    priority=int(priority),
                    img=img.value,
                    mimetype=img.type,
                    alt_text=alt_text,
                    title_text=title_text,
                    campaign=campaign)
     ad.put()
     if ad.is_saved():
         return self.redirect(
             webapp2.uri_for('advert.view', advert_id=ad.key().id()))
     self.response.set_status(500)
예제 #3
0
 def post(self, campaign_id):
     user = users.get_current_user()
     if not user:
         return self.redirect(users.create_login_url(self.request.uri))
     name = self.request.get('name', None)
     target_url = self.request.get('target_url', None)
     priority = self.request.get('priority', None)
     title = self.request.get('title', None)
     description_text_line_1 = self.request.get('description_text_line_1',
                                                None)
     description_text_line_2 = self.request.get('description_text_line_2',
                                                None)
     visible_url = self.request.get('visible_url', None)
     if not target_url or not title or not description_text_line_1:
         return self.get(campaign_id, [
             'Faltan campos obligatorios',
         ])
     campaign = Campaign.get_by_id(int(campaign_id))
     ad = TextAdvert(name=name,
                     target_url=target_url,
                     priority=int(priority),
                     title=title,
                     description_text_line_1=description_text_line_1,
                     description_text_line_2=description_text_line_2,
                     visible_url=visible_url,
                     campaign=campaign)
     ad.put()
     if ad.is_saved():
         return self.redirect(
             webapp2.uri_for('advert.view', advert_id=ad.key().id()))
     self.response.out.write("Error Raro")
예제 #4
0
 def post(self,campaign_id):
     user = users.get_current_user()
     if not user:
         return self.redirect(users.create_login_url(self.request.uri))
     name = self.request.get('name',None)
     target_url = self.request.get('target_url',None)
     priority = self.request.get('priority',None)
     img = self.request.POST['img']
     alt_text = self.request.get('alt_text',None)
     title_text = self.request.get('title_text',None)
     if not target_url  or not img.value:
         return self.get(campaign_id,['Faltan campos obligatorios',])
     campaign = Campaign.get_by_id(int(campaign_id))
     ad = ImgAdvert(
         name = name,
         target_url=target_url,
         priority=int(priority),
         img=img.value,
         mimetype=img.type,
         alt_text = alt_text,
         title_text = title_text,
         campaign = campaign)
     ad.put()
     if ad.is_saved():
         return self.redirect(webapp2.uri_for('advert.view',advert_id=ad.key().id()))
     self.response.set_status(500)
예제 #5
0
 def post(self,campaign_id):
     user = users.get_current_user()
     if not user:
         return self.redirect(users.create_login_url(self.request.uri))
     name = self.request.get('name',None)
     target_url = self.request.get('target_url',None)
     priority = self.request.get('priority',None)
     title = self.request.get('title',None)
     description_text_line_1 = self.request.get('description_text_line_1',None)
     description_text_line_2 = self.request.get('description_text_line_2',None)
     visible_url = self.request.get('visible_url',None)
     if not target_url or not title or not description_text_line_1:
         return self.get(campaign_id,['Faltan campos obligatorios',])
     campaign = Campaign.get_by_id(int(campaign_id))
     ad = TextAdvert(
         name = name,
         target_url=target_url,
         priority=int(priority),
         title=title,
         description_text_line_1=description_text_line_1,
         description_text_line_2=description_text_line_2,
         visible_url = visible_url,
         campaign=campaign)
     ad.put()
     if ad.is_saved():
         return self.redirect(webapp2.uri_for('advert.view',advert_id=ad.key().id()))
     self.response.out.write("Error Raro")
예제 #6
0
def img_json(ad):
    return simplejson.dumps({
        'name':
        ad.name,
        'target_url':
        ad.target_url,
        'mimetype':
        ad.mimetype,
        'img_path':
        webapp2.uri_for('image-server', img_advert_id=ad.key().id())
    })
예제 #7
0
def index_page(request, *args, **kwargs):
    response = webapp2.Response()
    response.write("<h1>Welcome to Huikau!</h1>")
    response.write("<a href='%s'>Home</a>" % webapp2.uri_for('home'))
    return response
예제 #8
0
def index_page(request, *args, **kwargs):
    response = webapp2.Response()
    response.write("<h1>Welcome to Huikau!</h1>")
    response.write("<a href='%s'>Home</a>" % webapp2.uri_for('home'))
    return response