Changeset 5650
- Timestamp:
- 11/03/08 15:53:23 (2 months ago)
- Files:
-
- trunk/README.txt (modified) (1 diff)
- trunk/tg/configuration.py (modified) (11 diffs)
- trunk/tg/tests/base.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/README.txt
r4568 r5650 1 TurboGears22 ===========3 4 Next generation Front-to-back web development megaframework built on Pylons.5 6 TurboGears2, provides a comprehensive web development toolkit.7 It is designed to help you create the basic outline of a database-driven8 web application in minutes.9 10 TurboGears provides you with sane default for designer friendly templates,11 tools to make AJAX, and dynamic Javascript driven pages easy on both the12 browser side and the server side.13 14 TurboGears is a project that is built upon a foundation of reuse and building up.15 In retrospect, much of the code that was home grown in the TurboGears project16 should have been released as independent projects that integrate with TurboGears.17 18 1 TurboGears is licensed under an MIT-style license (see LICENSE.txt). 19 2 Other incorporated projects may be licensed under different licenses. 20 3 All licenses allow for non-commercial and commercial use. 21 22 Working on TG223 --------------24 25 To be able to build TG2 packages or install it for development, you26 need Paver::27 28 easy_install Paver29 30 You can then run::31 32 paver develop33 34 to start working with the development version of TG2.trunk/tg/configuration.py
r5598 r5650 1 """ Simple AppSetup helper class"""1 """Configuration Helpers for TurboGears 2""" 2 2 import os 3 3 import logging … … 36 36 in the same process simultaniously, but to always get the right 37 37 config data for the app that's requesting them. 38 39 Sites, with seeking to maximize needs may perfer to use the pylons 40 config stacked object proxy directly, using just dictionary style 41 access, particularly whenever config is checked on a per-request 42 basis. 38 43 """ 39 44 40 45 def __init__(self, dict_to_wrap): 41 """Initialize by passing in a dictionaryto be wrapped"""46 """Initialize the object by passing in pylons config to be wrapped""" 42 47 self.__dict__['config_proxy'] = dict_to_wrap 43 48 … … 82 87 83 88 This class should have configuration/setup information 84 that is NECESSARYfor proper application function.89 that is *nessisary* for proper application function. 85 90 Deployment specific configuration information should go in 86 91 the config files (eg: dvelopment.ini or production.ini) … … 105 110 106 111 #Set individual defaults 112 self.auto_reload_templates = True 113 self.auth_backend = None 114 self.default_renderer = 'genshi' 115 self.serve_static = True 107 116 self.stand_alone = True 108 self.default_renderer = 'genshi'109 self.auth_backend = None110 self.serve_static = True111 117 self.use_legacy_renderer = True 112 self.auto_reload_templates = True 118 self.use_toscawidgets = True 119 self.use_transaction_manager = True 113 120 114 121 def setup_paths(self): … … 128 135 129 136 tg.config is a proxy for pylons.config that allows attribute style 130 access, so it's automatically setup when we create the poylons config 131 132 Besides basic initialization, this method copies all the values 133 in base_config into the ``tg.config`` object. 137 access, so it's automatically setup when we create the pylons 138 config. 139 140 Besides basic initialization, this method copies all the values 141 in base_config into the ``pylons.config`` and ``tg.config`` 142 objects. 143 134 144 """ 135 145 pylons_config.init_app(global_conf, app_conf, … … 141 151 """Setup the default TG2 routes 142 152 143 Overide this and setup your own routes maps if you want to use routes. 144 """ 153 Overide this and setup your own routes maps if you want to use 154 custom routes. 155 156 """ 157 145 158 map = Mapper(directory=config['pylons.paths']['controllers'], 146 159 always_scan=config['debug']) … … 154 167 155 168 def setup_helpers_and_globals(self): 169 """Add Hepers and Globals objects to the config. 170 171 Overide this method to customize the way that ``app_globals`` 172 and ``helpers`` are setup. 173 """ 174 156 175 config['pylons.app_globals'] = self.package.lib.app_globals.Globals() 176 config['pylons.helpers'] = self.package.lib.helpers 157 177 config['pylons.h'] = self.package.lib.helpers 158 178 159 179 def setup_sa_auth_backend(self): 180 """This method adds sa_auth information to the config.""" 160 181 defaults = { 161 182 'form_plugin': None … … 168 189 169 190 def setup_mako_renderer(self): 170 """Setup a renderer and loader for mako templates""" 191 """Setup a renderer and loader for mako templates 192 193 Overide this to customize the way that the mako template 194 renderer is setup. In particular if you want to setup 195 a different set of search paths, different encodings, or 196 additonal imports, all you need to do is update the 197 ``TemplateLookup`` constructor. 198 199 You can also use your own render_mako function instead of the one 200 provided by tg.render. 201 """ 171 202 from mako.lookup import TemplateLookup 172 203 from tg.render import render_mako … … 183 214 184 215 def setup_genshi_renderer(self): 185 """Setup a renderer and loader for Genshi templates""" 216 """Setup a renderer and loader for Genshi templates 217 218 Overide this to customize the way that the internationalization 219 filter, template loader """ 186 220 from genshi.template import TemplateLoader 187 221 from tg.render import render_genshi … … 373 407 """Create a tg WSGI application and return it 374 408 409 ``wrap_app`` 410 a WSGI middleware component which takes the core turbogears 411 application and wraps it -- inside all the WSGI-components 412 provided by TG and Pylons. This allows you to work with the 413 full environ that your tg app would get before anything 414 happens in the app itself. 415 375 416 ``global_conf`` 376 The inherited configuration for this application. Normally from377 the [DEFAULT] section of the Paste ini file.417 The inherited configuration for this application. Normally 418 fromthe [DEFAULT] section of the Paste ini file. 378 419 379 420 ``full_stack`` … … 394 435 wrap_app(app) 395 436 app = self.add_core_middleware(app) 396 app = self.add_tosca_middleware(app) 437 438 if self.use_toscawidgets: 439 app = self.add_tosca_middleware(app) 397 440 398 441 if self.auth_backend == "sqlalchemy": 399 442 app = self.add_auth_middleware(app) 400 401 app = self.add_tm_middleware(app) 443 444 if self.use_transaction_manager: 445 app = self.add_tm_middleware(app) 446 402 447 if self.use_sqlalchemy: 403 448 if not hasattr(self, 'DBSession'): trunk/tg/tests/base.py
r5585 r5650 117 117 118 118 def __init__(self, folder, values=None): 119 119 AppConfig.__init__(self) 120 120 #First we setup some base values that we know will work 121 121 self.renderers = ['genshi'] … … 129 129 self.use_legacy_renderer = True 130 130 self.serve_static = False 131 131 132 132 133 #Then we overide those values with what was passed in