Esempio n. 1
0
    def __before__(self):
        # self.sessions_ = {}

        self.stype_config_ = Session.query(StypeConfig)
        self.version_tpl_mapping_ = Session.query(VersionTplMapping)
        self.data_version_ = Session.query(DataVersion)
        self.tpl_views_ = Session.query(TplView)

        self.apply_feeds_ = Session.query(ApplyNewFeed)
        self.apply_versions_ = Session.query(ApplyNewVersion)
        self.apply_tpls_ = Session.query(ApplyNewTpl)
        self.apply_rollbacks_ = Session.query(ApplyRollback)
        self.apply_publishs_ = Session.query(ApplyPublish)

        self.user_applies_ = Session.query(UserApply)
Esempio n. 2
0
  def __before__(self):
    # self.sessions_ = {}

    self.stype_config_ = Session.query(StypeConfig)
    self.version_tpl_mapping_ = Session.query(VersionTplMapping)
    self.data_version_ = Session.query(DataVersion)
    self.tpl_views_ = Session.query(TplView)

    self.apply_feeds_ = Session.query(ApplyNewFeed)
    self.apply_versions_ = Session.query(ApplyNewVersion)
    self.apply_tpls_ = Session.query(ApplyNewTpl)
    self.apply_rollbacks_ = Session.query(ApplyRollback)
    self.apply_publishs_ = Session.query(ApplyPublish)

    self.user_applies_ = Session.query(UserApply)
Esempio n. 3
0
  def ApplyNewFeedSubmit(self):
    max_id = Session.query(func.max(ApplyNewFeed.apply_id)).scalar() or 0

    pm_emails = request.params['pm_emails']
    pm_names = request.params['pm_names']
    stype_desc = request.params['stype_desc']
    a = ApplyNewFeed(max_id + 1,
        pm_names = pm_names, 
        pm_emails = pm_emails, 
        dev_names = request.params['dev_names'], 
        dev_emails = request.params['dev_emails'], 
        stype_desc = stype_desc, 
        stype_text = request.params['stype_text'], 
        push_news = int(request.params['push_news']), 
        push_mini = int(request.params['push_mini']), 
        news_merge_desc = request.params['news_merge_desc'], 
        mini_merge_desc = request.params['mini_merge_desc'], 
        lifetime = int(request.params['lifetime']), 
        status = 0,
        apply_time = int(time.time())
        )
    Session.add(a)
    Session.commit()

    self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
    return '申请保存成功'
Esempio n. 4
0
 def AddStypeVersion(self):
   stype = int(request.params['stype'])
   max_ver = Session.query(func.max(DataVersion.version)).filter_by(stype = stype).scalar() or 0
   vc = DataVersion(stype, max_ver + 1, 0, 0)
   Session.add(vc)
   Session.commit()
   return str(max_ver + 1)
Esempio n. 5
0
    def ApplyNewFeedSubmit(self):
        max_id = Session.query(func.max(ApplyNewFeed.apply_id)).scalar() or 0

        pm_emails = request.params['pm_emails']
        pm_names = request.params['pm_names']
        stype_desc = request.params['stype_desc']
        a = ApplyNewFeed(max_id + 1,
                         pm_names=pm_names,
                         pm_emails=pm_emails,
                         dev_names=request.params['dev_names'],
                         dev_emails=request.params['dev_emails'],
                         stype_desc=stype_desc,
                         stype_text=request.params['stype_text'],
                         push_news=int(request.params['push_news']),
                         push_mini=int(request.params['push_mini']),
                         news_merge_desc=request.params['news_merge_desc'],
                         mini_merge_desc=request.params['mini_merge_desc'],
                         lifetime=int(request.params['lifetime']),
                         status=0,
                         apply_time=int(time.time()))
        Session.add(a)
        Session.commit()

        self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型',
                      pm_names + ':' + stype_desc)
        return '申请保存成功'
Esempio n. 6
0
 def AddStypeVersion(self):
     stype = int(request.params['stype'])
     max_ver = Session.query(func.max(
         DataVersion.version)).filter_by(stype=stype).scalar() or 0
     vc = DataVersion(stype, max_ver + 1, 0, 0)
     Session.add(vc)
     Session.commit()
     return str(max_ver + 1)
Esempio n. 7
0
  def AddVersionTpl(self):
    max_id = Session.query(func.max(VersionTplMapping.tpl_id)).scalar() or 1
    tpl_id = max_id + 1
    feed_key = VersionTplMapping(tpl_id = tpl_id,
        stype = request.params['stype'],
        version = request.params['version'])
    Session.add(feed_key)

    Session.commit()
    return str(tpl_id)
Esempio n. 8
0
 def GetStypeIds(self):
   ids = Session.query(StypeConfig.stype)
   rsp = '['
   count = 0
   for o in ids:
     if count > 0:
       rsp += ','
     rsp += str(o[0])
     count += 1
   rsp += ']'
   return rsp
Esempio n. 9
0
    def AddVersionTpl(self):
        max_id = Session.query(func.max(
            VersionTplMapping.tpl_id)).scalar() or 1
        tpl_id = max_id + 1
        feed_key = VersionTplMapping(tpl_id=tpl_id,
                                     stype=request.params['stype'],
                                     version=request.params['version'])
        Session.add(feed_key)

        Session.commit()
        return str(tpl_id)
Esempio n. 10
0
 def GetStypeIds(self):
     ids = Session.query(StypeConfig.stype)
     rsp = '['
     count = 0
     for o in ids:
         if count > 0:
             rsp += ','
         rsp += str(o[0])
         count += 1
     rsp += ']'
     return rsp
Esempio n. 11
0
  def UserApplySubmit(self):
    pm_emails = request.params['pm_emails']
    pm_names = request.params['pm_names']
    feed_desc = request.params['feed_desc']
    apply_id = 0
    if "apply_id" in request.params:
      apply_id = int(request.params['apply_id'])

    print "apply_id", apply_id

    if "apply_id" in request.params:
      a = self.user_applies_.filter_by(apply_id = apply_id).first()
      if a:
        a.pm_names = pm_names
        a.pm_emails = pm_emails
        a.dev_names = request.params['dev_names']
        a.dev_emails = request.params['dev_emails']
        a.feed_stype = int(request.params['feed_stype'])
        a.feed_desc = feed_desc
        a.apply_type = int(request.params['apply_type'])
        a.apply_desc = request.params['apply_desc']
        a.push_news = int(request.params['push_news'])
        a.push_mini = int(request.params['push_mini'])
        a.news_merge_desc = request.params['news_merge_desc']
        a.mini_merge_desc = request.params['mini_merge_desc']
        a.status = 0
        a.apply_time = int(time.time())
      else:
        return '申请id不群在'
    else:
      max_id = Session.query(func.max(UserApply.apply_id)).scalar() or 0
      a = UserApply(max_id + 1,
          pm_names = pm_names, 
          pm_emails = pm_emails, 
          dev_names = request.params['dev_names'], 
          dev_emails = request.params['dev_emails'], 
          feed_stype = int(request.params['feed_stype']), 
          feed_desc = feed_desc, 
          apply_type = int(request.params['apply_type']), 
          apply_desc = request.params['apply_desc'], 
          push_news = int(request.params['push_news']), 
          push_mini = int(request.params['push_mini']), 
          news_merge_desc = request.params['news_merge_desc'], 
          mini_merge_desc = request.params['mini_merge_desc'], 
          status = 0,
          apply_time = int(time.time())
          )
      Session.add(a)
    Session.commit()

    # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
    return '申请保存成功'
Esempio n. 12
0
    def UserApplySubmit(self):
        pm_emails = request.params['pm_emails']
        pm_names = request.params['pm_names']
        feed_desc = request.params['feed_desc']
        apply_id = 0
        if "apply_id" in request.params:
            apply_id = int(request.params['apply_id'])

        print "apply_id", apply_id

        if "apply_id" in request.params:
            a = self.user_applies_.filter_by(apply_id=apply_id).first()
            if a:
                a.pm_names = pm_names
                a.pm_emails = pm_emails
                a.dev_names = request.params['dev_names']
                a.dev_emails = request.params['dev_emails']
                a.feed_stype = int(request.params['feed_stype'])
                a.feed_desc = feed_desc
                a.apply_type = int(request.params['apply_type'])
                a.apply_desc = request.params['apply_desc']
                a.push_news = int(request.params['push_news'])
                a.push_mini = int(request.params['push_mini'])
                a.news_merge_desc = request.params['news_merge_desc']
                a.mini_merge_desc = request.params['mini_merge_desc']
                a.status = 0
                a.apply_time = int(time.time())
            else:
                return '申请id不群在'
        else:
            max_id = Session.query(func.max(UserApply.apply_id)).scalar() or 0
            a = UserApply(max_id + 1,
                          pm_names=pm_names,
                          pm_emails=pm_emails,
                          dev_names=request.params['dev_names'],
                          dev_emails=request.params['dev_emails'],
                          feed_stype=int(request.params['feed_stype']),
                          feed_desc=feed_desc,
                          apply_type=int(request.params['apply_type']),
                          apply_desc=request.params['apply_desc'],
                          push_news=int(request.params['push_news']),
                          push_mini=int(request.params['push_mini']),
                          news_merge_desc=request.params['news_merge_desc'],
                          mini_merge_desc=request.params['mini_merge_desc'],
                          status=0,
                          apply_time=int(time.time()))
            Session.add(a)
        Session.commit()

        # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
        return '申请保存成功'
Esempio n. 13
0
    def ApplyPublishSubmit(self):
        max_id = Session.query(func.max(ApplyPublish.apply_id)).scalar() or 0

        pm_emails = request.params['pm_emails']
        pm_names = request.params['pm_names']
        publish_desc = request.params['publish_desc']
        a = ApplyPublish(max_id + 1,
                         stype_id=int(request.params['stype_id']),
                         version=int(request.params['version']),
                         tpl_id=int(request.params['tpl_id']),
                         pm_names=pm_names,
                         pm_emails=pm_emails,
                         dev_names=request.params['dev_names'],
                         dev_emails=request.params['dev_emails'],
                         publish_desc=publish_desc,
                         status=0,
                         apply_time=int(time.time()))
        Session.add(a)
        Session.commit()

        # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
        return '申请保存成功'
Esempio n. 14
0
  def ApplyNewVersionSubmit(self):
    max_id = Session.query(func.max(ApplyNewVersion.apply_id)).scalar() or 0

    pm_emails = request.params['pm_emails']
    pm_names = request.params['pm_names']
    version_desc = request.params['version_desc']
    a = ApplyNewVersion(max_id + 1,
        stype_id = int(request.params['stype_id']),
        from_version_id = int(request.params['from_version_id']),
        pm_names = pm_names, 
        pm_emails = pm_emails, 
        dev_names = request.params['dev_names'], 
        dev_emails = request.params['dev_emails'], 
        version_desc = version_desc, 
        version_text = request.params['version_text'], 
        status = 0,
        apply_time = int(time.time())
        )
    Session.add(a)
    Session.commit()

    # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
    return '申请保存成功'
Esempio n. 15
0
  def ApplyPublishSubmit(self):
    max_id = Session.query(func.max(ApplyPublish.apply_id)).scalar() or 0

    pm_emails = request.params['pm_emails']
    pm_names = request.params['pm_names']
    publish_desc = request.params['publish_desc']
    a = ApplyPublish(max_id + 1,
        stype_id = int(request.params['stype_id']),
        version = int(request.params['version']),
        tpl_id = int(request.params['tpl_id']),
        pm_names = pm_names, 
        pm_emails = pm_emails, 
        dev_names = request.params['dev_names'], 
        dev_emails = request.params['dev_emails'], 
        publish_desc = publish_desc, 
        status = 0,
        apply_time = int(time.time())
        )
    Session.add(a)
    Session.commit()

    # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
    return '申请保存成功'
Esempio n. 16
0
    def ApplyNewVersionSubmit(self):
        max_id = Session.query(func.max(
            ApplyNewVersion.apply_id)).scalar() or 0

        pm_emails = request.params['pm_emails']
        pm_names = request.params['pm_names']
        version_desc = request.params['version_desc']
        a = ApplyNewVersion(max_id + 1,
                            stype_id=int(request.params['stype_id']),
                            from_version_id=int(
                                request.params['from_version_id']),
                            pm_names=pm_names,
                            pm_emails=pm_emails,
                            dev_names=request.params['dev_names'],
                            dev_emails=request.params['dev_emails'],
                            version_desc=version_desc,
                            version_text=request.params['version_text'],
                            status=0,
                            apply_time=int(time.time()))
        Session.add(a)
        Session.commit()

        # self.SendMail('*****@*****.**', pm_emails, '申请创建新鲜事类型', pm_names + ':' + stype_desc)
        return '申请保存成功'