Esempio n. 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
        )
Esempio n. 2
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)
Esempio n. 3
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)
Esempio n. 4
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)
Esempio n. 5
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)
Esempio n. 6
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)
Esempio n. 7
0
def site_new(name, admin_id, state):
    if state not in ZSITE_STATE_SITE2CN_DICT:
        state = ZSITE_STATE_SITE_PUBLIC

    site = zsite_new(name, CID_SITE, state)
    site_id = site.id
    zsite_admin_new(site_id, admin_id)

    if state > ZSITE_STATE_SITE_SECRET:
        zsite_show_new(site_id, CID_SITE)

    mq_buzz_site_new(admin_id, site_id)
    search_new(site_id)
    return site
Esempio n. 8
0
def save_school(self):
    current_user_id = self.current_user_id
    current_user = self.current_user
    search_new(current_user_id)
    arguments = parse_qs(self.request.body, True)

    for i in zip(
            arguments['school_id'],
            arguments['school_year'],
            arguments['school_degree'],
            arguments['school_department'],
            arguments['txt'],
            arguments['id'],
    ):

        user_school_new(current_user, *i)
Esempio n. 9
0
def save_school(self):
    current_user_id = self.current_user_id
    search_new(current_user_id)
    arguments = parse_qs(self.request.body, True)


    for i in zip(
        arguments['school_id'],
        arguments['school_year'],
        arguments['school_degree'],
        arguments['school_department'],
        arguments['txt'],
        arguments['id'],
    ):

        user_school_new(current_user_id, *i)
Esempio n. 10
0
def save_school(self):
    current_user_id = self.current_user_id
    current_user = self.current_user
    search_new(current_user_id)
    arguments = parse_qs(self.request.body, True)

    for i in zip(
        arguments["school_id"],
        arguments["school_year"],
        arguments["school_degree"],
        arguments["school_department"],
        arguments["txt"],
        arguments["id"],
    ):

        user_school_new(current_user, *i)