From 824882a1d855a5061c82ec454e21b584f01fa2fc Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 20 Aug 2007 20:28:17 +0000 Subject: [PATCH] Factored out hardcoded support email address from various places. Now it's configurable in the common settings. --- config/Common.py | 1 + controller/Root.py | 4 ++-- controller/Updater.py | 4 ++-- tools/initdb.py | 3 ++- view/Error_page.py | 4 ++-- view/Not_found_page.py | 4 ++-- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/config/Common.py b/config/Common.py index 01a3512..bffe914 100644 --- a/config/Common.py +++ b/config/Common.py @@ -19,5 +19,6 @@ settings = { "luminotes.https_url": "", "luminotes.http_proxy_ip": "127.0.0.1", "luminotes.https_proxy_ip": "127.0.0.2", + "luminotes.support_email": "support@luminotes.com", }, } diff --git a/controller/Root.py b/controller/Root.py index 8573209..34b57ce 100644 --- a/controller/Root.py +++ b/controller/Root.py @@ -77,13 +77,13 @@ class Root( object ): if status == 404: cherrypy.response.headerMap[ u"Status" ] = u"404 Not Found" cherrypy.response.status = status - cherrypy.response.body = [ unicode( Not_found_page() ) ] + cherrypy.response.body = [ unicode( Not_found_page( self.__settings[ u"global" ].get( u"luminotes.support_email" ) ) ) ] return import traceback traceback.print_exc() - cherrypy.response.body = [ unicode( Error_page() ) ] + cherrypy.response.body = [ unicode( Error_page( self.__settings[ u"global" ].get( u"luminotes.support_email" ) ) ) ] scheduler = property( lambda self: self.__scheduler ) database = property( lambda self: self.__database ) diff --git a/controller/Updater.py b/controller/Updater.py index 4c08276..2a6927c 100644 --- a/controller/Updater.py +++ b/controller/Updater.py @@ -24,7 +24,7 @@ def wait_for_update( function ): try: return queue.get( block = True, timeout = TIMEOUT_SECONDS ) except Empty: - return { "error": u"A timeout occurred when processing your request. Please try again or contact support@luminotes.com" } + return { "error": u"A timeout occurred when processing your request. Please try again or contact support." } return get_message @@ -66,7 +66,7 @@ def update_client( function ): result = error.to_dict() queue.put( result ) else: - queue.put( { "error": u"An error occurred when processing your request. Please try again or contact support@luminotes.com" } ) + queue.put( { "error": u"An error occurred when processing your request. Please try again or contact support." } ) raise return put_message diff --git a/tools/initdb.py b/tools/initdb.py index 6b5028d..59da8e1 100644 --- a/tools/initdb.py +++ b/tools/initdb.py @@ -99,8 +99,9 @@ def fix_note_contents( contents, notebook_id, note_ids ): LINK_PATTERN = re.compile( '(]*>)([^<]*)()' ) - # plug in the notebook id where appropriate + # plug in the notebook id and support email address where appropriate contents = contents.replace( "%s", notebook_id ) + contents = contents.replace( "support@luminotes.com", settings[ u"global" ].get( u"luminotes.support_email", u"" ) ) # stitch together note links to use the actual note ids of the referenced notes. # also, use the https URL for certain links if one is configured diff --git a/view/Error_page.py b/view/Error_page.py index f50b3c8..ce9b42b 100644 --- a/view/Error_page.py +++ b/view/Error_page.py @@ -3,7 +3,7 @@ from Tags import Div, H2, P, A, Ul, Li, Strong class Error_page( Page ): - def __init__( self ): + def __init__( self, support_email ): title = u"uh oh" Page.__init__( @@ -13,7 +13,7 @@ class Error_page( Page ): H2( title ), P( u"Something went wrong! If you care, please", - A( "let us know about it.", href = "mailto:support@luminotes.com" ), + A( "let us know about it.", href = "mailto:%s" % support_email ), u"Be sure to include the following information:", ), Ul( diff --git a/view/Not_found_page.py b/view/Not_found_page.py index 0b0f974..fc93a3f 100644 --- a/view/Not_found_page.py +++ b/view/Not_found_page.py @@ -3,7 +3,7 @@ from Tags import Div, H2, P, A class Not_found_page( Page ): - def __init__( self ): + def __init__( self, support_email ): title = u"404" Page.__init__( @@ -13,7 +13,7 @@ class Not_found_page( Page ): H2( title ), P( u"This is not the page you're looking for. If you care, please", - A( "let us know about it.", href = "mailto:support@luminotes.com" ), + A( "let us know about it.", href = "mailto:%s" % support_email ), ), P( u"Thanks!",