Example #1
0
    def post(self):
        try:
            addon = datetime.datetime.now()
            data = self._get_postdata(addon=addon)
            r, v = self._save(data)
            for i in data.get('labels', ()):
                if i:
                    addlabel(3, i)

            self.write(dict(status=r, data=v))
        except Exception as e:
            self.write(dict(status=False, data=e.message))
Example #2
0
    def post(self):
        try:
            addon = datetime.datetime.now()
            data = self._get_postdata(addon=addon)
            r,v = self._save(data)
            for i in data.get('labels',()):
                if i:
                    addlabel(3,i)

            self.write(dict(status=r,data=v)) 
        except Exception as e:
            self.write(dict(status=False,data=e.message))
Example #3
0
    def post(self):
        try:
            addon = datetime.datetime.now()
            data = self._get_postdata(addon=addon)
            intro = re.sub(strip_tag_pat, ' ', data.get('body', ''))
            data['intro'] = intro[0:100]
            r, v = self._save(data)
            for i in data.get('labels', ()):
                if i:
                    addlabel(3, i)

            self.write(dict(status=r, data=v))
        except Exception as e:
            self.write(dict(status=False, data=e.message))
Example #4
0
    def post(self):
        try:
            addon = datetime.datetime.now()
            data = self._get_postdata(addon=addon)
            intro = re.sub(strip_tag_pat,' ',data.get('body',''))
            data['intro'] = intro[0:100]
            r,v = self._save(data)
            for i in data.get('labels',()):
                if i:
                    addlabel(3,i)

            self.write(dict(status=r,data=v)) 
        except Exception as e:
            self.write(dict(status=False,data=e.message))
Example #5
0
    def get(self):
        args = {
            'mobile': self.get_argument('mobile', None),
            'labels': self.get_arguments('labels'),
            'profession': self.get_arguments('profession'),
            'intro': self.get_argument('intro'),
            'skill': self.get_arguments('skill'),
            'area': self.get_argumet('area'),
            'nickname': self.get_argument('nickname'),
            'parent_city': self.get_argument('parent_city', None),
            'city': self.get_argument('city', None)
        }

        uv = AModel.info(self.uid)
        for i in args.get('profession'):
            if i and not i in uv.get('profession',()):
                addlabel(0,i)

        for i in args.get('skill'):
            if i and not i in uv.get('skill',()):
                addlabel(1,i)

        for i in args.get('labels'):
            if i and not i in uv.get('labels',()):
                addlabel(2,i)

        v = AModel.update(self.uid, **args)
        self.write(dict(status=True, data=v))
Example #6
0
    def get(self):
        args = {
            'mobile': self.get_argument('mobile', None),
            'labels': self.get_arguments('labels'),
            'profession': self.get_arguments('profession'),
            'intro': self.get_argument('intro'),
            'skill': self.get_arguments('skill'),
            'nickname': self.get_argument('nickname'),
            'parent_city': self.get_argument('parent_city', None),
            'city': self.get_argument('city', None)
        }

        ur,uv = m_info(T_ACCOUNT,self.uid)
        
        for i in args.get('profession'):
            if i and not i in uv.get('profession',()):
                addlabel(0,i)

        for i in args.get('skill'):
            if i and not i in uv.get('skill',()):
                addlabel(1,i)

        for i in args.get('labels'):
            if i and not i in uv.get('labels',()):
                addlabel(2,i)

        r, v = m_update(T_ACCOUNT, self.uid, **args)
        self.write(dict(status=r, data=v))