web2py
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | web2py [2011/08/13 13:54] (current) – created jtkorb | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Controller index Code that Needs a CAS Ticket to Work ====== | ||
+ | <code python> | ||
+ | def index(): | ||
+ | """ | ||
+ | example action using the internationalization operator T and flash | ||
+ | rendered by views/ | ||
+ | """ | ||
+ | |||
+ | import urllib | ||
+ | import xml.dom.minidom as dom | ||
+ | import xml.parsers.expat as expat | ||
+ | | ||
+ | check_url = ' | ||
+ | my_url = ' | ||
+ | | ||
+ | if request.vars.ticket: | ||
+ | url = " | ||
+ | else: | ||
+ | url = ' | ||
+ | |||
+ | data = urllib.urlopen(url).read() | ||
+ | attrs = dict() | ||
+ | try: | ||
+ | dxml = dom.parseString(data) | ||
+ | envelop = dxml.getElementsByTagName(" | ||
+ | if len(envelop) > 0: | ||
+ | for x in envelop[0].childNodes: | ||
+ | if x.nodeName.startswith(' | ||
+ | key = x.nodeName[4: | ||
+ | value = x.childNodes[0].nodeValue.encode(' | ||
+ | attrs[key] = value | ||
+ | else: | ||
+ | attrs[' | ||
+ | except expat.ExpatError: | ||
+ | attrs[' | ||
+ | | ||
+ | return dict(message=T(' | ||
+ | </ |
web2py.txt · Last modified: 2011/08/13 13:54 by jtkorb