Created
August 12, 2010 19:42
-
-
Save thurloat/521587 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ResponseObject(): | |
html = None | |
def __init__(self, html): | |
self.html = html | |
def render(self): | |
print "<html>" | |
print self.html | |
print "</html>" | |
def get_user_information(): | |
raise ResponseObject("<p>Logged In User Is Steve</p>") | |
def main(): | |
response = ResponseObject("<h1>Exception Pattern</h1>") | |
try: | |
get_user_information() | |
except ResponseObject, e: | |
response.html += e.html | |
raise response | |
try: | |
main() | |
except ResponseObject, res: | |
print res.render() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment