Changeset 14638
- Timestamp:
- Mar 25, 2016, 6:22:36 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
. (modified) (1 prop)
-
trac/admin/web_ui.py (modified) (3 diffs)
-
trac/env.py (modified) (5 diffs)
-
trac/loader.py (modified) (3 diffs)
-
trac/tests/functional/testcases.py (modified) (7 diffs)
-
trac/tests/functional/testenv.py (modified) (2 diffs)
-
trac/ticket/tests/functional/main.py (modified) (3 diffs)
-
trac/web/chrome.py (modified) (2 diffs)
-
trac/wiki/tests/functional.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/1.0-stable merged: 14637
- Property svn:mergeinfo changed
-
trunk/trac/admin/web_ui.py
r14614 r14638 502 502 "egg")) 503 503 504 target_path = os.path.join(self.env.p ath, 'plugins', plugin_filename)504 target_path = os.path.join(self.env.plugins_dir, plugin_filename) 505 505 if os.path.isfile(target_path): 506 506 raise TracError(_("Plugin %(name)s already installed", … … 528 528 if not plugin_filename: 529 529 return 530 plugin_path = os.path.join(self.env.p ath, 'plugins', plugin_filename)530 plugin_path = os.path.join(self.env.plugins_dir, plugin_filename) 531 531 if not os.path.isfile(plugin_path): 532 532 return … … 599 599 data = { 600 600 'plugins': plugins, 'show': req.args.get('show'), 601 'readonly': not os.access(self.env. get_plugins_dir(),601 'readonly': not os.access(self.env.plugins_dir, 602 602 os.F_OK + os.W_OK), 603 603 'safe_wiki_to_html': safe_wiki_to_html, -
trunk/trac/env.py
r14614 r14638 557 557 if not os.path.exists(self.path): 558 558 os.mkdir(self.path) 559 os.mkdir(self. get_log_dir())560 os.mkdir(self. get_htdocs_dir())561 os.mkdir( os.path.join(self.path, 'plugins'))559 os.mkdir(self.log_dir) 560 os.mkdir(self.htdocs_dir) 561 os.mkdir(self.plugins_dir) 562 562 563 563 # Create a few files … … 568 568 569 569 # Setup the default configuration 570 os.mkdir( os.path.join(self.path, 'conf'))570 os.mkdir(self.conf_dir) 571 571 create_file(self.config_file_path + '.sample') 572 572 config = Configuration(self.config_file_path) … … 641 641 def config_file_path(self): 642 642 """Path of the trac.ini file.""" 643 return os.path.join(self. path, 'conf', 'trac.ini')643 return os.path.join(self.conf_dir, 'trac.ini') 644 644 645 645 def _get_path_to_dir(self, dir): … … 647 647 return os.path.normcase(os.path.realpath(path)) 648 648 649 @lazy 650 def conf_dir(self): 651 """Absolute path to the conf directory. 652 653 :since: 1.0.11 654 """ 655 return self._get_path_to_dir('conf') 656 657 @lazy 658 def htdocs_dir(self): 659 """Absolute path to the htdocs directory. 660 661 :since: 1.0.11 662 """ 663 return self._get_path_to_dir('htdocs') 664 665 def get_htdocs_dir(self): 666 """Return absolute path to the htdocs directory. 667 668 :since 1.0.11: Deprecated and will be removed in 1.3.1. Use the 669 `htdocs_dir` property instead. 670 """ 671 return self._get_path_to_dir('htdocs') 672 673 @lazy 674 def log_dir(self): 675 """Absolute path to the log directory. 676 677 :since: 1.0.11 678 """ 679 return self._get_path_to_dir('log') 680 681 def get_log_dir(self): 682 """Return absolute path to the log directory. 683 684 :since 1.0.11: Deprecated and will be removed in 1.3.1. Use the 685 `log_dir` property instead. 686 """ 687 return self._get_path_to_dir('log') 688 689 @lazy 690 def plugins_dir(self): 691 """Absolute path to the plugins directory. 692 693 :since: 1.0.11 694 """ 695 return self._get_path_to_dir('plugins') 696 697 @lazy 698 def templates_dir(self): 699 """Absolute path to the templates directory. 700 701 :since: 1.0.11 702 """ 703 return self._get_path_to_dir('templates') 704 649 705 def get_templates_dir(self): 650 """Return absolute path to the templates directory.""" 706 """Return absolute path to the templates directory. 707 708 :since 1.0.11: Deprecated and will be removed in 1.3.1. Use the 709 `templates_dir` property instead. 710 """ 651 711 return self._get_path_to_dir('templates') 652 653 def get_htdocs_dir(self):654 """Return absolute path to the htdocs directory."""655 return self._get_path_to_dir('htdocs')656 657 def get_log_dir(self):658 """Return absolute path to the log directory."""659 return self._get_path_to_dir('log')660 661 def get_plugins_dir(self):662 """Return absolute path to the plugins directory."""663 return self._get_path_to_dir('plugins')664 712 665 713 def setup_log(self): … … 668 716 logfile = self.log_file 669 717 if logtype == 'file' and not os.path.isabs(logfile): 670 logfile = os.path.join(self. get_log_dir(), logfile)718 logfile = os.path.join(self.log_dir, logfile) 671 719 format = self.log_format 672 720 logid = 'Trac.%s' % hashlib.sha1(self.path).hexdigest() -
trunk/trac/loader.py
r14614 r14638 102 102 """Return the path to the `plugins` directory of the environment. 103 103 104 :since 1.0.11: Deprecated and will be removed in 1.3.1. Use 105 Environment. get_plugins_dir()instead."""106 return env. get_plugins_dir()104 :since 1.0.11: Deprecated and will be removed in 1.3.1. Use the 105 Environment.plugins_dir property instead.""" 106 return env.plugins_dir 107 107 108 108 … … 110 110 load_py_files())): 111 111 """Load all plugin components found on the given search path.""" 112 plugins_dir = env. get_plugins_dir()112 plugins_dir = env.plugins_dir 113 113 search_path = [plugins_dir] 114 114 if extra_path: … … 139 139 return dist 140 140 141 plugins_dir = env. get_plugins_dir()141 plugins_dir = env.plugins_dir 142 142 plugins = {} 143 143 from trac.core import ComponentMeta -
trunk/trac/tests/functional/testcases.py
r14306 r14638 55 55 env.config.set('components', 'RaiseExceptionPlugin.*', 'enabled') 56 56 env.config.save() 57 create_file(os.path.join(env.path, 'plugins', 58 'RaiseExceptionPlugin.py'), 57 create_file(os.path.join(env.plugins_dir, 'RaiseExceptionPlugin.py'), 59 58 """\ 60 59 from trac.core import Component, implements … … 99 98 """Test for regression of the plugin reload fix in r6017""" 100 99 # Setup the DeleteTicket plugin 100 env = self._testenv.get_trac_environment() 101 101 plugin = open(os.path.join(self._testenv.trac_src, 102 102 'sample-plugins', 'workflow', 103 103 'DeleteTicket.py')).read() 104 open(os.path.join(self._testenv.tracdir, 'plugins', 105 'DeleteTicket.py'), 'w').write(plugin) 106 env = self._testenv.get_trac_environment() 104 plugin_path = os.path.join(env.plugins_dir, 'DeleteTicket.py') 105 open(plugin_path, 'w').write(plugin) 107 106 prevconfig = env.config.get('ticket', 'workflow') 108 107 env.config.set('ticket', 'workflow', … … 123 122 env.config.save() 124 123 for ext in ('py', 'pyc', 'pyo'): 125 filename = os.path.join( self._testenv.tracdir, 'plugins',124 filename = os.path.join(env.plugins_dir, 126 125 'DeleteTicket.%s' % ext) 127 126 if os.path.exists(filename): … … 132 131 def runTest(self): 133 132 """Test for regression of http://trac.edgewall.org/ticket/3833 a""" 133 env = self._testenv.get_trac_environment() 134 134 # Assume the logging is already set to debug. 135 traclogfile = open(os.path.join(self._testenv.tracdir, 'log', 136 'trac.log')) 135 traclogfile = open(os.path.join(env.log_dir, 'trac.log')) 137 136 # Seek to the end of file so we only look at new log output 138 137 traclogfile.seek(0, 2) 138 139 139 # Verify that logging is on initially 140 env = self._testenv.get_trac_environment()141 142 140 env.log.debug("RegressionTestTicket3833 debug1") 143 141 debug1 = traclogfile.read() … … 152 150 # Turn logging off, try to log something, and verify that it does 153 151 # not show up. 154 traclogfile = open(os.path.join(self._testenv.tracdir, 'log',155 'trac.log'))152 env = self._testenv.get_trac_environment() 153 traclogfile = open(os.path.join(env.log_dir, 'trac.log')) 156 154 # Seek to the end of file so we only look at new log output 157 155 traclogfile.seek(0, 2) 158 env = self._testenv.get_trac_environment()159 156 160 157 env.config.set('logging', 'log_level', 'INFO') … … 176 173 # Turn logging back on, try to log something, and verify that it 177 174 # does show up. 178 traclogfile = open(os.path.join(self._testenv.tracdir, 'log',179 'trac.log'))175 env = self._testenv.get_trac_environment() 176 traclogfile = open(os.path.join(env.log_dir, 'trac.log')) 180 177 # Seek to the end of file so we only look at new log output 181 178 traclogfile.seek(0, 2) 182 env = self._testenv.get_trac_environment()183 179 184 180 env.config.set('logging', 'log_level', 'DEBUG') … … 318 314 env.config.set('components', 'RaiseExceptionPlugin.*', 'enabled') 319 315 env.config.save() 320 create_file(os.path.join(env.p ath, 'plugins', 'RaiseExceptionPlugin.py'),316 create_file(os.path.join(env.plugins_dir, 'RaiseExceptionPlugin.py'), 321 317 """\ 322 318 from trac.core import Component, implements -
trunk/trac/tests/functional/testenv.py
r13994 r14638 337 337 filename = 'authz-' + \ 338 338 hashlib.md5(str(authz_content)).hexdigest()[:9] 339 authz_file = os.path.join(self.tracdir, 'conf', filename) 339 env = self.get_trac_environment() 340 authz_file = os.path.join(env.conf_dir, filename) 340 341 if os.path.exists(authz_file): 341 342 wait_for_file_mtime_change(authz_file) … … 353 354 with open(authz_file, 'w') as f: 354 355 parser.write(f) 355 env = self.get_trac_environment()356 356 permission_policies = env.config.get('trac', 'permission_policies') 357 357 env.config.set('trac', 'permission_policies', -
trunk/trac/ticket/tests/functional/main.py
r14481 r14638 143 143 env.config.set('components', plugin_name + '.*', 'enabled') 144 144 env.config.save() 145 create_file(os.path.join(env.p ath, 'plugins', plugin_name + '.py'),145 create_file(os.path.join(env.plugins_dir, plugin_name + '.py'), 146 146 """\ 147 147 from genshi.builder import tag … … 1257 1257 plugin = open(os.path.join(self._testenv.trac_src, 'sample-plugins', 1258 1258 'workflow', 'DeleteTicket.py')).read() 1259 open(os.path.join(self._testenv.tracdir, 'plugins',1260 'DeleteTicket.py'), 'w').write(plugin)1261 1259 env = self._testenv.get_trac_environment() 1260 plugin_path = os.path.join(env.plugins_dir, 'DeleteTicket.py') 1261 open(plugin_path, 'w').write(plugin) 1262 1262 prevconfig = env.config.get('ticket', 'workflow') 1263 1263 env.config.set('ticket', 'workflow', … … 1285 1285 self._testenv.get_trac_environment() # reload environment 1286 1286 for ext in ('py', 'pyc', 'pyo'): 1287 filename = os.path.join(self._testenv.tracdir, 'plugins', 1288 'DeleteTicket.%s' % ext) 1287 filename = os.path.join(env.plugins_dir, 'DeleteTicket.%s' % ext) 1289 1288 if os.path.exists(filename): 1290 1289 os.unlink(filename) -
trunk/trac/web/chrome.py
r14510 r14638 737 737 return [('common', pkg_resources.resource_filename('trac', 'htdocs')), 738 738 ('shared', self.shared_htdocs_dir), 739 ('site', self.env. get_htdocs_dir())]739 ('site', self.env.htdocs_dir)] 740 740 741 741 def get_templates_dirs(self): 742 742 return filter(None, [ 743 self.env. get_templates_dir(),743 self.env.templates_dir, 744 744 self.shared_templates_dir, 745 745 pkg_resources.resource_filename('trac', 'templates'), … … 1188 1188 files = {} 1189 1189 # Collect templates list 1190 site_templates = list_dir(self.env. get_templates_dir(), '.html')1190 site_templates = list_dir(self.env.templates_dir, '.html') 1191 1191 shared_templates = list_dir(Chrome(self.env).shared_templates_dir, 1192 1192 '.html') 1193 1193 1194 1194 # Collect static resources list 1195 site_htdocs = list_dir(self.env. get_htdocs_dir())1195 site_htdocs = list_dir(self.env.htdocs_dir) 1196 1196 shared_htdocs = list_dir(Chrome(self.env).shared_htdocs_dir) 1197 1197 -
trunk/trac/wiki/tests/functional.py
r14131 r14638 88 88 env.config.set('components', plugin_name + '.*', 'enabled') 89 89 env.config.save() 90 create_file(os.path.join(env.path, 'plugins', 91 plugin_name + '.py'), """\ 90 create_file(os.path.join(env.plugins_dir, plugin_name + '.py'), """\ 92 91 from genshi.builder import tag 93 92 from trac.core import Component, implements
Note:
See TracChangeset
for help on using the changeset viewer.
