Esempio n. 1
0
 def save(self):
     id = int(self.get_argument('id', 0))
     platform_id = int(self.get_argument('platform_id', 6))
     run_id = int(self.get_argument('run_id', 0))
     plan_id = int(self.get_argument('plan_id', 0))
     partner_id = int(self.get_argument('partner_id', 0))
     version_name = self.get_argument('version_name', '').replace('__', '.')
     product_name = self.get_argument('product_name', '')
     status = self.get_argument('status', 'pas')
     print 'aa', self.get_argument('mask', '')
     mask = [
         self.get_argument(i, '') for i in self.request.arguments
         if i.startswith('mask__')
     ]
     mask = ','.join([i for i in mask if i])
     modes = [
         self.get_argument(i, '') for i in self.request.arguments
         if i.startswith('mode__')
     ]
     modes = ','.join([i for i in modes if i])
     print mask, modes
     if id:
         s = Scope.mgr(ismaster=True).Q().filter(id=id)[0]
     else:
         s = Scope.new()
     s.platform_id, s.run_id, s.plan_id = platform_id, run_id, plan_id
     s.partner_id, s.version_name, s.product_name = partner_id, version_name, product_name
     s.status, s.mask, s.modes = status, mask, modes
     s = s.save()
     self.json2dwz('200',
                   'closeCurrent',
                   'dlist',
                   forwardUrl='scope/list?id=%s' % s.id)
Esempio n. 2
0
 def import_partner_productname(self, mode, start):
     if mode != 'day':
         return 0
     print "start importing new scope"
     start,end = self.normlize_time(mode,start)
     res = self.service.get_partner_product(start,end)
     #res = self.org_service.get_partner_product(start,end)
     for i in res:
         if not (i.isdigit() and int(i)<1000000 and int(i)>1000):
             continue
         try:
             q = Scope.new().Q().filter(partner_id=i,product_name='',run_id='',version_name='',plan_id='')
             q.filter(platform_id=6)
             if not q[0]:
                 s = Scope.new()
                 s.platform_id = 6
                 s.partner_id = i
                 s.save()
             for j in res[i]:
                 if re.search(r'^[\s0-9a-zA-Z+()_-]+$',j):
                     q = Scope.new().Q().filter(partner_id=i,product_name=j,run_id='',version_name='',plan_id='')
                     q.filter(platform_id=6)
                     if not q[0]:
                         s = Scope.new()
                         s.platform_id = 6
                         s.partner_id = i
                         s.product_name = j
                         s.save()
                     q = Scope.new().Q().filter(partner_id='',product_name=j,run_id='',version_name='',plan_id='')
                     q.filter(platform_id=6)
                     if not q[0]:
                         s = Scope.new()
                         s.platform_id = 6
                         s.product_name = j
                         s.save()
             for j in ['ireader_1.6','ireader_1.7','ireader_1.8','ireader_2.0','ireader_2.1','ireader_2.2','ireader_2.3','ireader_2.4','ireader_2.6','ireader_2.7','ireader_3.0','ireader_3.1','ireader_3.2']:
                 q = Scope.new().Q().filter(partner_id=i,product_name='',run_id='',version_name=j,plan_id='')
                 q.filter(platform_id=6)
                 if not q[0]:
                     s = Scope.new()
                     s.platform_id = 6
                     s.partner_id = i
                     s.version_name = j
                     s.save()
         except Exception,e:
             logging.error('%s\n',str(e),exc_info=True)
Esempio n. 3
0
 def save(self):
     id = int(self.get_argument('id',0))
     platform_id = int(self.get_argument('platform_id',6))
     run_id = int(self.get_argument('run_id',0))
     plan_id = int(self.get_argument('plan_id',0))
     partner_id = int(self.get_argument('partner_id',0))
     version_name = self.get_argument('version_name','').replace('__','.')
     product_name = self.get_argument('product_name','')
     status = self.get_argument('status','pas')
     print 'aa',self.get_argument('mask','')
     mask = [self.get_argument(i,'') for i in self.request.arguments if i.startswith('mask__')]
     mask = ','.join([i for i in mask if i])
     modes = [self.get_argument(i,'') for i in self.request.arguments if i.startswith('mode__')]
     modes = ','.join([i for i in modes if i])
     print mask,modes
     if id:
         s = Scope.mgr(ismaster=True).Q().filter(id=id)[0]
     else:
         s = Scope.new()
     s.platform_id,s.run_id,s.plan_id = platform_id,run_id,plan_id
     s.partner_id,s.version_name,s.product_name = partner_id,version_name,product_name
     s.status,s.mask,s.modes = status,mask,modes
     s = s.save()
     self.json2dwz('200','closeCurrent','dlist',forwardUrl='scope/list?id=%s'%s.id)
Esempio n. 4
0
 def import_partner_productname(self, mode, start):
     if mode != 'day':
         return 0
     print "start importing new scope"
     start, end = self.normlize_time(mode, start)
     res = self.service.get_partner_product(start, end)
     #res = self.org_service.get_partner_product(start,end)
     for i in res:
         if not (i.isdigit() and int(i) < 1000000 and int(i) > 1000):
             continue
         try:
             q = Scope.new().Q().filter(partner_id=i,
                                        product_name='',
                                        run_id='',
                                        version_name='',
                                        plan_id='')
             q.filter(platform_id=6)
             if not q[0]:
                 s = Scope.new()
                 s.platform_id = 6
                 s.partner_id = i
                 s.save()
             for j in res[i]:
                 if re.search(r'^[\s0-9a-zA-Z+()_-]+$', j):
                     q = Scope.new().Q().filter(partner_id=i,
                                                product_name=j,
                                                run_id='',
                                                version_name='',
                                                plan_id='')
                     q.filter(platform_id=6)
                     if not q[0]:
                         s = Scope.new()
                         s.platform_id = 6
                         s.partner_id = i
                         s.product_name = j
                         s.save()
                     q = Scope.new().Q().filter(partner_id='',
                                                product_name=j,
                                                run_id='',
                                                version_name='',
                                                plan_id='')
                     q.filter(platform_id=6)
                     if not q[0]:
                         s = Scope.new()
                         s.platform_id = 6
                         s.product_name = j
                         s.save()
             for j in [
                     'ireader_1.6', 'ireader_1.7', 'ireader_1.8',
                     'ireader_2.0', 'ireader_2.1', 'ireader_2.2',
                     'ireader_2.3', 'ireader_2.4', 'ireader_2.6',
                     'ireader_2.7', 'ireader_3.0', 'ireader_3.1',
                     'ireader_3.2'
             ]:
                 q = Scope.new().Q().filter(partner_id=i,
                                            product_name='',
                                            run_id='',
                                            version_name=j,
                                            plan_id='')
                 q.filter(platform_id=6)
                 if not q[0]:
                     s = Scope.new()
                     s.platform_id = 6
                     s.partner_id = i
                     s.version_name = j
                     s.save()
         except Exception, e:
             logging.error('%s\n', str(e), exc_info=True)