Skip to content

Commit db12005

Browse files
author
tailor
committed
[project @ fixed examples to use new openid directory structure]
1 parent f854729 commit db12005

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

examples/README

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ BaseHTTPServer.
44

55
To get the example system running:
66

7-
1) Start the consumer server:
7+
1) Start the consumer server (from within the examples dir):
88

9-
python examples/httpconsumer.py
9+
python httpconsumer.py
1010

1111
2) In a different terminal, start the server:
1212

13-
python examples/sampleserver.py
13+
python sampleserver.py
1414

1515

1616
3) Open your web browser, and go to the consumer server:
File renamed without changes.

examples/httpconsumer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from urlparse import urlparse
55

6-
from openid.examples import util
6+
import exutil
77
from openid.consumer import OpenIDConsumer, SimpleHTTPClient
88
from openid.interface import Request
99
from openid.association import *
@@ -45,7 +45,7 @@ def invalidate(self, server_url, assoc_handle):
4545
del self.associations[i]
4646
break
4747

48-
class ConsumerHandler(util.HTTPHandler):
48+
class ConsumerHandler(exutil.HTTPHandler):
4949
def _simplePage(self, msg):
5050
self._headers()
5151
self.wfile.write("""
@@ -78,7 +78,7 @@ def do_GET(self):
7878
try:
7979
# parse the input url
8080
proto, host, selector, params, qs, frag = urlparse(self.path)
81-
query = util.parseQuery(qs)
81+
query = exutil.parseQuery(qs)
8282

8383
# dispatch based on query args
8484
if 'identity_url' in query:

examples/sampleserver.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
import time, random, Cookie
44

55
from openid.util import random_string, w3cdate, append_args
6-
from openid.examples import util
76
from openid.errors import ProtocolError, NoOpenIDArgs
87
from openid.server import OpenIDServer
98
from openid.interface import Request, response_page, redirect
109
from openid.association import ServerAssociation
1110

11+
import exutil
12+
1213
addr = 'http://localhost:8082/'
1314

1415
class ConcreteServer(OpenIDServer):
@@ -199,7 +200,7 @@ def get_setup_response(self, req):
199200
</html>
200201
"""
201202

202-
class ServerHandler(util.HTTPHandler):
203+
class ServerHandler(exutil.HTTPHandler):
203204
def handleOpenIDRequest(self, req):
204205
try:
205206
response = server.handle(req)
@@ -258,7 +259,7 @@ def login(self, query):
258259

259260
def do_GET(self):
260261
parsed = urlparse(self.path)
261-
query = util.parseQuery(parsed[4])
262+
query = exutil.parseQuery(parsed[4])
262263
action = query.get('action')
263264
if action == 'openid':
264265
try:
@@ -288,11 +289,11 @@ def do_POST(self):
288289
# post data is urlencoded args
289290
content_length = int(self.headers['Content-Length'])
290291
post_data = self.rfile.read(content_length)
291-
query = util.parseQuery(post_data)
292-
query.update(util.parseQuery(urlparse(self.path)[4]))
292+
query = exutil.parseQuery(post_data)
293+
query.update(exutil.parseQuery(urlparse(self.path)[4]))
293294
action = query.get('action')
294295
if action is None:
295-
action = util.parseQuery(urlparse(self.path)[4]).get('action')
296+
action = exutil.parseQuery(urlparse(self.path)[4]).get('action')
296297

297298
if action == 'openid':
298299
self.handleOpenIDRequest(Request(query, 'POST'))

0 commit comments

Comments
 (0)