|
[Webware-checkins] r139 - Component LoginKit
From: <ianb@co...> - 2004-10-03 00:19
|
Author: ianb
Date: 2004-10-02 18:19:08 -0600 (Sat, 02 Oct 2004)
New Revision: 139
Modified:
Component/cpage.py
LoginKit/usercomponent.py
Log:
Some fixes to make this compatible with WSGI Webware
Modified: Component/cpage.py
===================================================================
--- Component/cpage.py 2004-09-22 17:09:51 UTC (rev 138)
+++ Component/cpage.py 2004-10-03 00:19:08 UTC (rev 139)
@@ -1,10 +1,16 @@
-from WebKit.Page import Page
try:
+ from WSGI.WSGIWebKit.wkservlet import Page
+except ImportError:
+ from WebKit.Page import Page
+try:
from WebKit.HTTPExceptions import *
hasExceptions = True
except ImportError:
hasExceptions = False
-from WebKit import AppServer
+try:
+ from WebKit import AppServer
+except ImportError:
+ AppServer = None
class CPage(Page):
@@ -147,10 +153,11 @@
def linkToSelf(self, absolute=False, extraURLPath=None, args=None):
name = self.__class__.__name__
contextName = self.request().contextName()
- app = AppServer.globalAppServer.application()
+ app = self.transaction().application()
if (contextName != app.setting('Contexts', {}).get('default')
and contextName != 'default'):
- name = contextName + '/' + name
+ if contextName:
+ name = contextName + '/' + name
return self.servletLink(
name,
absolute=absolute,
@@ -227,7 +234,7 @@
# Support old style actions from 0.5.x and below.
# Use setting OldStyleActions in Application.config
# to use this.
- if self.transaction().application().setting('OldStyleActions', ) \
+ if self.transaction().application().setting('OldStyleActions', False) \
and req.hasField('_action_'):
action = self.methodNameForAction(req.field('_action_'))
actions = self._actionSet()
Modified: LoginKit/usercomponent.py
===================================================================
--- LoginKit/usercomponent.py 2004-09-22 17:09:51 UTC (rev 138)
+++ LoginKit/usercomponent.py 2004-10-03 00:19:08 UTC (rev 139)
@@ -1,10 +1,15 @@
from Component import ServletComponent, Component
from WebUtils.Funcs import htmlEncode, urlEncode
try:
- from WebKit.HTTPExceptions import *
- hasExceptions = True
+ from WSGI.httpexceptions import *
+ HTTPAuthenticationRequired = HTTPUnauthorized
+ hasExceptions = False
except ImportError:
- hasExceptions = False
+ try:
+ from WebKit.HTTPExceptions import *
+ hasExceptions = True
+ except ImportError:
+ hasExceptions = False
import base64
|
| Thread | Author | Date |
|---|---|---|
| [Webware-checkins] r139 - Component LoginKit | <ianb@co...> |