def create_tag(self, tag_name):
        uid = tools.get_uu8d()
        while self.tab.select().where(self.tab.uid == uid).count() > 0:
            uid = tools.get_uu8d()

        entry = self.tab.create(uid=uid, name=tag_name, count=0)
        return entry.uid
Exemplo n.º 2
0
    def create_tag(self, tag_name):
        uid = tools.get_uu8d()
        while self.tab.select().where(self.tab.uid == uid).count() > 0:
            uid = tools.get_uu8d()

        entry = self.tab.create(
            uid=uid,
            name=tag_name,
            count=0
        )
        return entry.uid
Exemplo n.º 3
0
    def insert_data(self, post_data):
        title = post_data["title"][0]
        uu = self.get_by_wiki(title)
        if uu is None:
            pass
        else:
            return False

        if post_data["src_type"][0] == "1":
            cnt_html = tools.rst2html(post_data["cnt_md"][0])
        else:
            cnt_html = tools.markdown2html(post_data["cnt_md"][0])

        entry = CabWiki.create(
            title=post_data["title"][0],
            date=datetime.datetime.now(),
            cnt_html=cnt_html,
            uid=tools.get_uu8d(),
            time_create=tools.timestamp(),
            user_name=post_data["user_name"],
            cnt_md=tornado.escape.xhtml_escape(post_data["cnt_md"][0]),
            time_update=tools.timestamp(),
            view_count=1,
            src_type=post_data["src_type"][0],
        )
        return entry.uid
Exemplo n.º 4
0
    def gen_passwd(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)
        userinfo = self.muser.get_by_id(post_data['u'][0])

        sub_timestamp = int(post_data['t'][0])
        cur_timestamp = tools.timestamp()
        if cur_timestamp - sub_timestamp < 600 and cur_timestamp > sub_timestamp:
            pass
        else:
            kwd = {
                'info': '密码重置已超时!',
            }
            self.set_status(400)
            self.render('html/404.html', kwd=kwd)

        hash_str = tools.md5(userinfo.user_name + post_data['t'][0] + userinfo.user_pass)
        if hash_str == post_data['p'][0]:
            pass
        else:
            kwd = {
                'info': '密码重置验证出错!',
            }
            self.set_status(400)
            self.render('html/404.html', kwd=kwd)

        new_passwd = tools.get_uu8d()
        self.muser.update_pass(userinfo.user_name, new_passwd)
        kwd = {
            'user_name': userinfo.user_name,
            'new_pass': new_passwd,
        }
        self.render('{0}/user/show_pass.html'.format(self.tmpl_name), kwd=kwd)
Exemplo n.º 5
0
    def insert_data(self, post_data):
        title = post_data['title'][0]
        uu = self.get_by_wiki(title)
        if uu is None:
            pass
        else:
            return (False)
        if 'id_spec' in post_data:
            id_spec = post_data['id_spec'][0]
        else:
            id_spec = 0
        if post_data['src_type'][0] == '1':
            cnt_html = tools.rst2html(post_data['cnt_md'][0])
        else:
            cnt_html = tools.markdown2html(post_data['cnt_md'][0])

        entry = CabWiki.create(title=post_data['title'][0],
                               date=datetime.datetime.now(),
                               cnt_html=cnt_html,
                               uid=tools.get_uu8d(),
                               time_create=time.time(),
                               user_name=post_data['user_name'],
                               cnt_md=tornado.escape.xhtml_escape(
                                   post_data['cnt_md'][0]),
                               time_update=time.time(),
                               view_count=1,
                               src_type=post_data['src_type'][0])
        return (entry.uid)
Exemplo n.º 6
0
    def gen_passwd(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)
        userinfo = self.muser.get_by_id(post_data['u'][0])

        sub_timestamp = int(post_data['t'][0])
        cur_timestamp = tools.timestamp()
        if cur_timestamp - sub_timestamp < 600 and cur_timestamp > sub_timestamp:
            pass
        else:
            kwd = {
                'info': '密码重置已超时!',
            }
            self.set_status(400)
            self.render('html/404.html', kwd=kwd)

        hash_str = tools.md5(userinfo.user_name + post_data['t'][0] + userinfo.user_pass)
        if hash_str == post_data['p'][0]:
            pass
        else:
            kwd = {
                'info': '密码重置验证出错!',
            }
            self.set_status(400)
            self.render('html/404.html', kwd=kwd)

        new_passwd = tools.get_uu8d()
        self.muser.update_pass(userinfo.user_name, new_passwd)
        kwd = {
            'user_name': userinfo.user_name,
            'new_pass': new_passwd,
        }
        self.render('{0}/{1}/show_pass.html'.format(self.tmpl_name, self.tmpl_router), kwd=kwd)
Exemplo n.º 7
0
    def insert_data(self, post_data):
        title = post_data['title'][0]
        uu = self.get_by_wiki(title)
        if uu is None:
            pass
        else:
            return (False)
        if 'id_spec' in post_data:
            id_spec = post_data['id_spec'][0]
        else:
            id_spec = 0
        if post_data['src_type'][0] == '1':
            cnt_html = tools.rst2html(post_data['cnt_md'][0])
        else:
            cnt_html = tools.markdown2html(post_data['cnt_md'][0])

        entry = CabWiki.create(
            title=post_data['title'][0],
            date=datetime.datetime.now(),
            cnt_html=cnt_html,
            uid=tools.get_uu8d(),
            time_create=time.time(),
            user_name=post_data['user_name'],
            cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]),
            time_update=time.time(),
            view_count=1,
            src_type=post_data['src_type'][0]
        )
        return (entry.uid)
Exemplo n.º 8
0
 def add_or_update(self, post_data):
     entry = TabLayout.create(
         uid=tools.get_uu8d(),
         title='',
         app=post_data['map'][0],
         user=post_data['user'],
         json=post_data['geojson'][0] if 'geojson' in post_data else '',
         lon=float(post_data['lon'][0]),
         lat=float(post_data['lat'][0]),
         zoom=int(post_data['zoom'][0]),
         marker=int(post_data['marker'][0]) if 'marker' in post_data else 0,
         time_create=tools.timestamp(),
         time_update=tools.timestamp(),
         public=1,
     )
Exemplo n.º 9
0
    def insert_data(self, post_data):
        title = post_data['title'][0]
        uu = self.get_by_wiki(title)
        if uu is None:
            pass
        else:
            return (False)

        cnt_html = tools.markdown2html(post_data['cnt_md'][0])

        entry = CabWiki.create(
            title=post_data['title'][0],
            date=datetime.datetime.now(),
            cnt_html=cnt_html,
            uid=tools.get_uu8d(),
            time_create=tools.timestamp(),
            user_name=post_data['user_name'],
            cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]),
            time_update=tools.timestamp(),
            view_count=1,
        )
        return (entry.uid)
Exemplo n.º 10
0
    def insert_data(self, post_data):
        title = post_data['title'][0]
        uu = self.get_by_wiki(title)
        if uu is None:
            pass
        else:
            return (False)


        cnt_html = tools.markdown2html(post_data['cnt_md'][0])

        entry = CabWiki.create(
            title=post_data['title'][0],
            date=datetime.datetime.now(),
            cnt_html=cnt_html,
            uid=tools.get_uu8d(),
            time_create=tools.timestamp(),
            user_name=post_data['user_name'],
            cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]),
            time_update=tools.timestamp(),
            view_count=1,
        )
        return (entry.uid)