Exemple #1
0
    def post(self):
        errtip, link_cid, link_kv, name, motto, url, txt, pic_id = self._site_save()
        current_user_id = self.current_user_id
        zsite_id = self.zsite_id
        zsite = self.zsite

        success = False

        if not errtip:
            success = True
            if not url_by_id(zsite_id) and url:
                url_new(zsite_id, url)
            zsite.name = name
            zsite.save()

            link_list_save(zsite_id, link_cid, link_kv)
            txt_new(zsite_id, txt)
            motto_set(zsite_id, motto)
            site_ico_bind(current_user_id, pic_id, zsite_id)
            search_new(zsite_id)

        self.render(
            success=success,
            errtip=errtip,
            link_cid=link_cid,
            link_list=link_kv,
            name=name,
            motto=motto,
            txt=txt,
            pic_id=pic_id,
            url=url
        )
Exemple #2
0
    def post(self):
        errtip, link_cid, link_kv, name, motto, url, txt, pic_id = self._site_save(
        )
        current_user_id = self.current_user_id
        zsite_id = self.zsite_id
        zsite = self.zsite

        success = False

        if not errtip:
            success = True
            if not url_by_id(zsite_id) and url:
                url_new(zsite_id, url)
            zsite.name = name
            zsite.save()

            link_list_save(zsite_id, link_cid, link_kv)
            txt_new(zsite_id, txt)
            motto_set(zsite_id, motto)
            site_ico_bind(current_user_id, pic_id, zsite_id)
            search_new(zsite_id)

        self.render(success=success,
                    errtip=errtip,
                    link_cid=link_cid,
                    link_list=link_kv,
                    name=name,
                    motto=motto,
                    txt=txt,
                    pic_id=pic_id,
                    url=url)
Exemple #3
0
    def post(self, id):
        zsite = Zsite.mc_get(id)
        user_info = UserInfo.get(id)

        name = self.get_argument('name', None)
        motto = self.get_argument('motto', None)
        txt = self.get_argument('txt', '')
        sex = self.get_argument('sex', 0)

        if name:
            zsite.name = name
            zsite.save()

        if motto:
            _motto.set(id, motto)

        if txt:
            txt_new(id, txt)

        if sex:
            user_info.sex = sex
            user_info.save()

        search_new(id)
        self.redirect('/zsite/%s' % id)
Exemple #4
0
    def post(self):

        sitetype = int(self.get_argument('sitetype'))
        errtip, link_cid, link_kv, name, motto, url, txt, pic_id = self._site_save()
        current_user = self.current_user
        current_user_id = current_user.id

        if not errtip:
            site = site_new(name, current_user_id, sitetype)
            site_id = site.id
            link_list_save(site_id, link_cid, link_kv)
            site_ico_bind(current_user_id, pic_id, site_id)
            motto_set(site_id, motto)
            txt_new(site_id, txt)
            if url:
                url_new(site_id, url)
            self.redirect(site.link)
            return


        return self.render(
            errtip=errtip,
            link_cid=link_cid,
            link_list=link_kv,
            name=name,
            motto=motto,
            url=url,
            sitetype=sitetype,
            txt=txt,
            pic_id=pic_id
        )
Exemple #5
0
def save_user_info(self):
    current_user_id = self.current_user_id

    name = self.get_argument('name', None)
    if name and not name.isdigit():
        zsite_name_edit(current_user_id, name)

    motto = self.get_argument('motto', None)
    if motto:
        _motto.set(current_user_id, motto)

    txt = self.get_argument('txt', '')
    if txt:
        txt_new(current_user_id, txt)

    birthday = self.get_argument('birthday', '0')
    birthday = int(birthday)
    marry = self.get_argument('marry', '')
    pid_home = self.get_argument('pid_home', '1')
    pid_now = self.get_argument('pid_now', '1')
    try:
        pid_now = int(pid_now)
    except ValueError:
        pid_now = 0
    try:
        pid_home = int(pid_home)
    except ValueError:
        pid_home = 0

    marry = int(marry)
    if marry not in (1, 2, 3):
        marry = 0

    o = user_info_new(current_user_id, birthday, marry, pid_home)
    if pid_now:
        c = namecard_get(current_user_id)
        if c:
            c.pid_now = pid_now
            c.save()
        else:
            c = namecard_new(current_user_id, pid_now=pid_now)

    if not o.sex:
        sex = self.get_argument('sex', 0)
        if sex and not o.sex:
            sex = int(sex)
            if sex not in (1, 2):
                sex = 0
            if sex:
                if o:
                    o.sex = sex
                    o.save()
                else:
                    user_info_new(current_user_id, sex=sex)

    search_new(current_user_id)
Exemple #6
0
def save_user_info(self):
    current_user_id = self.current_user_id

    name = self.get_argument('name', None)
    if name:
        zsite_name_edit(current_user_id, name)

    motto = self.get_argument('motto', None)
    if motto:
        _motto.set(current_user_id, motto)

    txt = self.get_argument('txt', '')
    if txt:
        txt_new(current_user_id, txt)

    birthday = self.get_argument('birthday', '0')
    birthday = int(birthday)
    marry = self.get_argument('marry', '')
    pid_home = self.get_argument('pid_home', '1')
    pid_now = self.get_argument('pid_now', '1')
    try:
        pid_now = int(pid_now)
    except ValueError:
        pid_now = 0
    try:
        pid_home = int(pid_home)
    except ValueError:
        pid_home = 0

    marry = int(marry)
    if marry not in (1, 2, 3):
        marry = 0

    o = user_info_new(current_user_id, birthday, marry, pid_home)
    if pid_now:
        c = namecard_get(current_user_id)
        if c:
            c.pid_now = pid_now
            c.save()
        else:
            c = namecard_new(current_user_id, pid_now=pid_now)

    if not o.sex:
        sex = self.get_argument('sex', 0)
        if sex and not o.sex:
            sex = int(sex)
            if sex not in (1, 2):
                sex = 0
            if sex:
                if o:
                    o.sex = sex
                    o.save()
                else:
                    user_info_new(current_user_id, sex=sex)

    search_new(current_user_id)
Exemple #7
0
def save_user_info(self):
    current_user_id = self.current_user_id

    name = self.get_argument("name", None)
    if name and not name.isdigit():
        zsite_name_edit(current_user_id, name)

    motto = self.get_argument("motto", None)
    if motto:
        _motto.set(current_user_id, motto)

    txt = self.get_argument("txt", "")
    if txt:
        txt_new(current_user_id, txt)

    birthday = self.get_argument("birthday", "0")
    birthday = int(birthday)
    marry = self.get_argument("marry", "")
    pid_home = self.get_argument("pid_home", "1")
    pid_now = self.get_argument("pid_now", "1")
    try:
        pid_now = int(pid_now)
    except ValueError:
        pid_now = 0
    try:
        pid_home = int(pid_home)
    except ValueError:
        pid_home = 0

    marry = int(marry)
    if marry not in (1, 2, 3):
        marry = 0

    o = user_info_new(current_user_id, birthday, marry, pid_home)
    if pid_now:
        c = namecard_get(current_user_id)
        if c:
            c.pid_now = pid_now
            c.save()
        else:
            c = namecard_new(current_user_id, pid_now=pid_now)

    if not o.sex:
        sex = self.get_argument("sex", 0)
        if sex and not o.sex:
            sex = int(sex)
            if sex not in (1, 2):
                sex = 0
            if sex:
                if o:
                    o.sex = sex
                    o.save()
                else:
                    user_info_new(current_user_id, sex=sex)

    search_new(current_user_id)