当前位置: 首页>>代码示例>>Python>>正文


Python Directory.login方法代码示例

本文整理汇总了Python中Directory.login方法的典型用法代码示例。如果您正苦于以下问题:Python Directory.login方法的具体用法?Python Directory.login怎么用?Python Directory.login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Directory的用法示例。


在下文中一共展示了Directory.login方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle_cgi_request

# 需要导入模块: import Directory [as 别名]
# 或者: from Directory import login [as 别名]
    def handle_cgi_request(self):
        """Handles a cgi request.  This is the main entry point for client requests,
       whether POST or GET, that are cgi-bin requests.  They all share the
       same memory space (i.e. this singleton object)."""

        # parse the form parameters to the form object
        # if a post request, encode everything (post requests can't encode on the client side because they come from forms)
        # get requests should encode on the client side (to handle special characters in the URL)
        if self.method.lower() == "get":
            for item in self.form.list:
                item.value = Constants.decode(item.value)

        # set the window id
        self.windowid = self.getvalue("global_windowid")

        # send the headers
        self.send_headers()

        try:

            # get the view
            viewst = self.getvalue("global_view", "meetingchooser").lower()

            # get the session, if there is one
            self.session = Directory.get_session(self.form.getvalue("z", ""))

            # if session is none, try logging the user in based upon their username and password parameters
            if self.session == None:
                self.session = Directory.login(self.form.getvalue("username", ""), self.form.getvalue("password", ""))

            # if the view is login, log the session out
            if (viewst == "login" or viewst == "logout") and self.session != None:
                Directory.logout(self.session)
                self.session = None

            # if session is still None, send them to the login page
            if self.session == None:
                viewst = "login"

            # process actions
            if self.session:
                Events.process_actions(self)

            # send events xml or send to view processing
            if self.getvalue("gm_internal_action") == "send_events_xml":
                Events.send_events_xml(self)

            else:
                # get the view
                if not BaseView.views.has_key(viewst):
                    self.writeln("<html><body>Error!  No view named " + viewst + " found.</body></html>")
                    return
                view = BaseView.views[viewst]
                self.view = view

                # send processing to the view
                Constants.log.debug("Sending processing to view: " + viewst)
                view.handle_request(self, viewst)

        except:
            self.writeln("<html><body>")
            self.writeln("<hr>")
            self.writeln("<b>The following error has occurred in the GroupMind application:</b>")
            self.writeln("<pre><tt>")
            traceback.print_exc(file=self.out)
            traceback.print_exc()
            self.writeln("</pre></tt>")
            self.writeln("</body></html>")
开发者ID:ssaltzman,项目名称:POET,代码行数:70,代码来源:GroupMind.py


注:本文中的Directory.login方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。