⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 useractivate.py

📁 python web programming 部分
💻 PY
字号:
#! python
#
# $Workfile: UserActivate.py $ $Revision: 4 $
# $Date: 9/12/01 7:59p $ $Author: Sholden $
#
import User

from Params import WEBMASTER
from Error import Error
import whrandom
import smtplib
import mx.DateTime as mxdt
import mx.DateTime.ARPA as arpa
import pickle

class Page(User.Page):

    def Body(self):
        if not self.path or len(self.path[0]) != 21:
            raise Error(400, "Bad Request", errmsg="A confirmation number is required.")
        conf = int(self.path[0][7:14])
        sql = "SELECT %s FROM Wannabe WHERE StdConf=%%s" % ", ".join(User.StdNames+["StdOrder"])
        User.cursor.execute(sql, (conf, ))
        r = User.cursor.fetchall()
        if not r:
            return """<P>Unable to find confirmation number %s.</P>
                <P>Either you have already confirmed your membership,
                or you confirmation number is incorrect.</P>
                <P>Please <A HREF="mailto:%s">email us</A> and
                we will try to resolve the problem.</P>""" % \
                            (self.path[0], WEBMASTER)
        sql = "INSERT INTO Student (%s) VALUES (%s)" % (
                            ", ".join(["CrDT"] + User.StdNames),
                            ", ".join("%s"*(len(User.StdNames)+1)))
        User.cursor.execute(sql, (mxdt.DateTimeFromTicks(int(mxdt.now())), )+r[0][:-1])
        User.cursor.execute("DELETE FROM Wannabe WHERE StdConf=%s", (conf, ))
        User.conn.commit()
        self.session._bookings = pickle.loads(r[0][-1])
        if self.session._bookings:
            orderp = """
                <P><B>Click here to <A HREF="/CourseChkOut/">verify your order</A>
                and proceed with confirmation.</B></P>
                """
        else:
            orderp =""
                
        return """
            <H3>User Account Created</H3>
            <P>Thank you. By using this link you have allowed
            us to verify your email address. You can now use
            the restricted functions of the site by logging
            as outlined in your confirmatory email.</P>
            """ + orderp



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -