Beispiel #1
0
    def test_upadte(self):
        label = dict(name='80后',category=1)
        val = m_exists(TName,**label)
        if val:
            print m_del(TName,val['_id'])

        print add(1,'80后')
        print add(1,'80后')
        print add(1,'80后')
        
        print add(1,'90后')
        print add(1,'90后')

        val = m_exists(TName,**label)
        print val
        assert val['usage'] ==3

        print 'suggest:',suggest(1)
Beispiel #2
0
    def test_update(self):
        label = dict(name='80后',category=1)
        val = m_exists(TName,**label)
        if val:
            print m_del(TName,val['_id'])

        print add(1,'80后')
        print add(1,'80后')
        print add(1,'80后')
        
        print add(1,'90后')
        print add(1,'90后')

        val = m_exists(TName,**label)
        print val
        assert val['usage'] ==3

        print 'suggest:',suggest(1)
Beispiel #3
0
    def post(self):
        try:
            data = self._get_postdata()
            r = m_exists(T_CATEGORY, listname=data['listname'])
            if not r:
                r, data = self._save(data)
            else:
                r, data = False, "已存在此域名"

            self.write(dict(status=r, data=data))
        except Exception as e:
            self.write(dict(status=False, data=e.message))
Beispiel #4
0
    def post(self):
        try:
            data = self._get_postdata()
            r = m_exists(T_CATEGORY,listname=data['listname'])
            if not r:
                r, data = self._save(data)
            else:
                r, data = False,"已存在此域名"

            self.write(dict(status=r,data=data))
        except Exception as e:
            self.write(dict(status=False,data=e.message))