Exemplo n.º 1
0
    def get(self):
        try:
            # Get the db.User that represents the user on whose behalf the
            # consumer is making this request.
            user = users.get_current_user()
        except e:
            # The request was not a valid OAuth request.
            # ...
            #self.response.headers['Content-Type'] = 'text/plain; charset=UTF-8'
            #self.response.out.write('Auth error: The request was not a valid OAuth request.')
            user = None
        
        is_admin = False
        if user:
            greeting = ("Welcome, %s! (<a href=\"%s\">sign out</a>)" %
                        (user.nickname(), users.create_logout_url("/")))
            is_admin = users.is_current_user_admin()
        else:
            greeting = ("<a href=\"%s\">Sign in or register</a>" %
                        users.create_login_url("/admin"))
        
        branch = qs_branch(self)
        device = qs_device(self)

        path = os.path.join(os.path.dirname(__file__), 'admin.html')
        self.response.out.write(template.render(path, {"device": device, "branch": branch,
                                "greeting": greeting, "user": user, "is_admin": is_admin,
                                "custom_rom": custom_rom, "gerrit_url": gerrit_url}))
Exemplo n.º 2
0
    def get(self):
        device = qs_device(self)

        path = os.path.join(os.path.dirname(__file__), "index.html")
        self.response.out.write(
            template.render(path, {"devices": sorted(device_specific.keys()), "for_device": device})
        )
Exemplo n.º 3
0
 def get(self):
     if KangExtension().check(self) == False: return
     branch = qs_branch(self)
     device = qs_device(self)
     kang = qs_kang_name(self)
     kangId = qs_kang_id(self)
     
     kangs = Change.gql("WHERE branch = :branch AND project = 'KANG'", branch=branch)
     
     cmd_done = 0
     self.response.headers['Content-Type'] = 'text/html; charset=UTF-8'
     self.response.out.write("<h2>New KANG name '"+kang+"'</h2>\n")
     self.response.out.write("<table>")
     self.response.out.write("<thead><tr><td>id (click to rename)</td><td>info</td><td>branch</td><td>subject</td><td>project</td><td>last_updated</td></tr></thead><tbody>")
     for k in kangs:
         self.response.out.write('<tr><td><a href="/rename_kang-off/?branch='+k.branch+'&kang='+kang+'--NewName&kangId='+str(k.id)+'">'+str(k.id)+'</a></td><td>Checking KANG</td><td>'+k.branch+'</td><td>'+k.subject+'</td><td>'+k.project+'</td><td>'+str(k.last_updated)+'</td></tr>\n')
         if (str(k.id) == kangId):
             old_name = k.subject
             k.subject = kang+"#dev:"+device
             k.put()
             memcache_delete_multi(['last_changes', 'filtered'])
             self.response.out.write('<tr><td><a href="">'+str(k.id)+'</a></td><td>Renamed KANG (old: '+old_name+'; new: '+kang+')</td><td>'+k.branch+'</td><td>'+k.subject+'</td><td>'+k.project+'</td><td>'+str(k.last_updated)+'</td></tr>\n')
             cmd_done = 1
             break
     self.response.out.write("</tbody></table>")
     
     if cmd_done == 0:
         self.response.out.write("<h2>KANG not found: "+kangId+"</h2>\n")
Exemplo n.º 4
0
    def get(self):
        device = qs_device(self)

        path = os.path.join(os.path.dirname(__file__), 'rss.xml')
        self.response.out.write(
            template.render(path, {
                "device": device,
                "changes": self.nightlies(device)
            }))
Exemplo n.º 5
0
    def get(self):
        device = qs_device(self)

        path = os.path.join(os.path.dirname(__file__), 'index.html')
        self.response.out.write(
            template.render(path, {
                'devices': sorted(device_specific.keys()),
                "for_device": device
            }))
Exemplo n.º 6
0
 def get(self, device=None, branch=None):
     if device is None: device = qs_device(self)
     if branch is None: branch = qs_branch(self)
     
     path = os.path.join(os.path.dirname(__file__), 'rss.xml')
     self.response.headers['Content-Type'] = 'application/rss+xml'
     self.response.out.write(template.render(path, 
          {"url": self.request.host, "custom_rom": custom_rom, "now": datetime.now(), 
           "device": device, "branch": branch, "builds": self.merge_build(device, branch)}))
Exemplo n.º 7
0
 def get(self):
     device = qs_device(self)
     
     logging.debug("#######> DS: Maint: RmDuplicate")
     ch = Change.gql("ORDER BY id")
     
     seen = []
     self.response.headers['Content-Type'] = 'text/html; charset=UTF-8'
     self.response.out.write("<table>")
     self.response.out.write("<thead><tr><td>action</td><td>remote</td><td>branch</td><td>id</td><td>subject</td><td>project</td><td>last_updated</td></tr></thead><tbody>")
     timeout = True
     
     while timeout:
         try:
             for r in ch:
                 action = 'keep'
                 if r.id in seen:
                     action = 'remove'
                     r.delete()
                 
                 if r.remote is None:
                     r.remote = git_name
                 
                 if r.branch is None:
                     r.branch = 'gingerbread'
                     r.put()
                 
                 if r.project == 'KANG' and not re.search("^.*#dev:.*$", r.subject):
                     r.subject = r.subject+"#dev:"+device
                     r.put()
                 if r.project == 'KANG' and re.search("^.*?#dev:.*?#dev:.*$", r.subject):
                     r.subject = re.sub(r"^(.*?#dev:.*?)#dev:.*?$", r'\1', r.subject)
                     r.put()
                 if r.project == 'KANG' and re.search("^\d\d\d\d-\d\d-\d\d \d\d:\d\d - (.*#dev:.*)$", r.subject):
                     r.subject = re.sub(r"^\d\d\d\d-\d\d-\d\d \d\d:\d\d - (.*#dev:.*)$", r'\1', r.subject)
                     r.put()
                 
                 seen.append(r.id)
                 #r.subject = time.strftime('%Y-%m-%d %H:%M')+' - '
                 self.response.out.write("<tr>")
                 self.response.out.write("<td>"+action+"</td>\n")
                 self.response.out.write("<td>"+r.remote+"</td>\n")
                 self.response.out.write("<td>"+r.branch+"</td>\n")
                 self.response.out.write("<td>"+str(r.id)+"</td>\n")
                 self.response.out.write("<td>"+r.subject+"</td>\n")
                 self.response.out.write("<td>"+r.project+"</td>\n")
                 self.response.out.write("<td>"+str(r.last_updated)+"</td></tr>\n")
                 timeout = False
         
         except DeadlineExceededError:
             timeout = True
     
     self.response.out.write("</tbody></table>")
     memcache.flush_all()
     return
Exemplo n.º 8
0
 def get(self):
     device = qs_device(self)
     
     content_type = self.request.get('content_type')
     if content_type == '':
         content_type = 'application/json'
     
     force = self.request.get('force')
     if force == '':
         force = False
     else:
         force = True
     
     self.response.headers['Content-Type'] = content_type
     builds = CustomRomBuilds().getBuilds(device, force)
     self.response.out.write(json.dumps(builds, default=json_datetime_handler))
Exemplo n.º 9
0
 def get(self, device=None, branch=None):
     if device is None: device = qs_device(self)
     if branch is None: branch = qs_branch(self)
     
     device_config = CustomRomDevices().getDevices()
     manufacturer = ''
     dev_title = ''
     if device in device_config['dev']: 
         manufacturer = device_config['dev'][device]['manufacturer']
         dev_title    = device_config['dev'][device]['title']
     
     path = os.path.join(os.path.dirname(__file__), 'index.html')
     self.response.out.write(template.render(path,
         {"ga_tracking_id": ga_tracking_id, "custom_rom": custom_rom, "build_url": build_url, "gerrit_url": gerrit_url, "types": types,
          "url": self.request.host, "branch": branch, "device": device, "dev_title": dev_title, "manufacturer": manufacturer, "keywords": keywords,
          'devices': device_config, 'branches': branches, "changelog_server": changelog_server}))
Exemplo n.º 10
0
 def get(self):
     if KangExtension().check(self) == False: return
     kang = qs_kang_name(self)
     branch = qs_branch(self)
     device = qs_device(self)
     
     change = Change(id=int(time.time() * -1),
             branch = branch,
             project = 'KANG',
             subject = kang+'#dev:'+device,
             last_updated = time.strftime('%Y-%m-%d %H:%M:%S.000000000', time.gmtime(time.time()))
             )
     change.put()
     memcache_delete_multi(['last_changes', 'filtered'])
     self.response.headers['Content-Type'] = 'text/plain; charset=UTF-8'
     self.response.out.write("KEY: '"+str(change.key().id())+"'\n")
     self.response.out.write("Added KANG: '"+kang+"'\n")
Exemplo n.º 11
0
    def get(self):
        device = qs_device(self)

        devices = {}
        devices_tpl = []

        for name, repos in device_specific.items():
            manufacturer = repos[0].split("_")[2]

            # fix the moto_ and motorola_ to be the same manufacturer
            if manufacturer == "motorola":
                manufacturer = "moto"

            devices.setdefault(manufacturer, [])
            devices[manufacturer].append(name)

        for man, devices in devices.items():
            devices_tpl.append({'manufacturer': man, 'device_list': sorted(devices)})

        path = os.path.join(os.path.dirname(__file__), 'index.html')
        self.response.out.write(template.render(path,
            {"for_device": device, 'devices': devices_tpl}))
Exemplo n.º 12
0
 def get(self):
     kang = qs_kang_name(self)
     branch = qs_branch(self)
     device = qs_device(self)
     lc = LastChanges().get(branch)
     
     self.response.headers['Content-Type'] = 'text/plain; charset=UTF-8'
     status = 200
     for c in lc:
         if c.project == 'KANG' and re.search("^"+kang+"(#dev:"+device+")?$", c.subject):
             status = 201
             break
         elif c.project != 'KANG':
             break
     self.response.out.write("Changes available ("+str(status)+"): ")
     if status == 200:
         self.response.out.write("yes")
     else:
         self.response.out.write("no")
     self.response.out.write("\n")
     
     self.response.set_status(status)
     return status
Exemplo n.º 13
0
 def get(self):
     branch = qs_branch(self)
     device = qs_device(self)
     self.response.headers['Content-Type'] = 'text/html; charset=UTF-8'
     
     logging.debug("######> DS: read for DB dump")
     if self.request.get('filter') and self.request.get('filter') == "1":
          q = Change.gql("WHERE branch = :branch ORDER BY last_updated DESC", branch=branch)
     else:
          q = db.GqlQuery("SELECT * FROM Change ORDER BY last_updated DESC, id")
     ch = q.fetch(2000)
     
     self.response.out.write("<table>")
     self.response.out.write("<thead><tr><td>branch</td><td>id</td><td>subject</td><td>project</td><td>last_updated</td></tr></thead><tbody>")
     for r in ch:
         #r.subject = time.strftime('%Y-%m-%d %H:%M')+' - '
         self.response.out.write("<tr><td>"+r.branch+"</td>\n")
         self.response.out.write("<td>"+str(r.id)+"</td>\n")
         self.response.out.write("<td>"+r.subject+"</td>\n")
         self.response.out.write("<td>"+r.project+"</td>\n")
         self.response.out.write("<td>"+str(r.last_updated)+"</td></tr>\n")
     self.response.out.write("</tbody></table>")
     
     return
Exemplo n.º 14
0
    def get(self):
        device = qs_device(self)

        self.response.headers["Content-Type"] = "text/json"
        self.response.out.write(json.dumps(self.filter(device)))
Exemplo n.º 15
0
    def get(self):
        device = qs_device(self)

        path = os.path.join(os.path.dirname(__file__), 'rss.xml')
        self.response.out.write(template.render(path, {"device": device,
            "changes": self.nightlies(device)}))
Exemplo n.º 16
0
    def get(self):
        device = qs_device(self)

        self.response.headers['Content-Type'] = 'text/json'
        self.response.out.write(json.dumps(self.filter(device)))
Exemplo n.º 17
0
    def get(self):
        device = qs_device(self)

        self.response.headers['Content-Type'] = 'text/json'
        self.response.out.write(json.dumps(self.filter(device)))
Exemplo n.º 18
0
 def get(self):
     branch = qs_branch(self)
     device = qs_device(self)
     
     self.response.headers['Content-Type'] = 'application/json'
     self.response.out.write(json.dumps(self.filter(device, branch), default=json_datetime_handler))