Changeset 14637 in trac.svn
- Timestamp:
- Mar 25, 2016, 5:56:51 PM (8 years ago)
- Location:
- branches/1.0-stable/trac
- Files:
-
- 8 edited
-
admin/web_ui.py (modified) (3 diffs)
-
env.py (modified) (6 diffs)
-
loader.py (modified) (3 diffs)
-
tests/functional/testcases.py (modified) (7 diffs)
-
tests/functional/testenv.py (modified) (1 diff)
-
ticket/tests/functional.py (modified) (3 diffs)
-
web/chrome.py (modified) (2 diffs)
-
wiki/tests/functional.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0-stable/trac/admin/web_ui.py
r14613 r14637 490 490 "egg")) 491 491 492 target_path = os.path.join(self.env.p ath, 'plugins', plugin_filename)492 target_path = os.path.join(self.env.plugins_dir, plugin_filename) 493 493 if os.path.isfile(target_path): 494 494 raise TracError(_("Plugin %(name)s already installed", … … 516 516 if not plugin_filename: 517 517 return 518 plugin_path = os.path.join(self.env.p ath, 'plugins', plugin_filename)518 plugin_path = os.path.join(self.env.plugins_dir, plugin_filename) 519 519 if not os.path.isfile(plugin_path): 520 520 return … … 584 584 data = { 585 585 'plugins': plugins, 'show': req.args.get('show'), 586 'readonly': not os.access(self.env. get_plugins_dir(),586 'readonly': not os.access(self.env.plugins_dir, 587 587 os.F_OK + os.W_OK), 588 588 'safe_wiki_to_html': safe_wiki_to_html, -
branches/1.0-stable/trac/env.py
r14613 r14637 576 576 if not os.path.exists(self.path): 577 577 os.mkdir(self.path) 578 os.mkdir(self. get_log_dir())579 os.mkdir(self. get_htdocs_dir())580 os.mkdir( os.path.join(self.path, 'plugins'))578 os.mkdir(self.log_dir) 579 os.mkdir(self.htdocs_dir) 580 os.mkdir(self.plugins_dir) 581 581 582 582 # Create a few files … … 587 587 588 588 # Setup the default configuration 589 os.mkdir( os.path.join(self.path, 'conf'))590 create_file(os.path.join(self. path, 'conf', 'trac.ini.sample'))591 config = Configuration(os.path.join(self. path, 'conf', 'trac.ini'))589 os.mkdir(self.conf_dir) 590 create_file(os.path.join(self.conf_dir, 'trac.ini.sample')) 591 config = Configuration(os.path.join(self.conf_dir, 'trac.ini')) 592 592 for section, name, value in options: 593 593 config.set(section, name, value) … … 646 646 def setup_config(self): 647 647 """Load the configuration file.""" 648 self.config = Configuration(os.path.join(self. path, 'conf', 'trac.ini'),648 self.config = Configuration(os.path.join(self.conf_dir, 'trac.ini'), 649 649 {'envname': os.path.basename(self.path)}) 650 650 self.setup_log() … … 657 657 return os.path.normcase(os.path.realpath(path)) 658 658 659 @lazy 660 def conf_dir(self): 661 """Absolute path to the conf directory. 662 663 :since: 1.0.11 664 """ 665 return self._get_path_to_dir('conf') 666 667 @lazy 668 def htdocs_dir(self): 669 """Absolute path to the htdocs directory. 670 671 :since: 1.0.11 672 """ 673 return self._get_path_to_dir('htdocs') 674 675 def get_htdocs_dir(self): 676 """Return absolute path to the htdocs directory. 677 678 :since 1.0.11: Deprecated and will be removed in 1.3.1. Use the 679 `htdocs_dir` property instead. 680 """ 681 return self._get_path_to_dir('htdocs') 682 683 @lazy 684 def log_dir(self): 685 """Absolute path to the log directory. 686 687 :since: 1.0.11 688 """ 689 return self._get_path_to_dir('log') 690 691 def get_log_dir(self): 692 """Return absolute path to the log directory. 693 694 :since 1.0.11: Deprecated and will be removed in 1.3.1. Use the 695 `log_dir` property instead. 696 """ 697 return self._get_path_to_dir('log') 698 699 @lazy 700 def plugins_dir(self): 701 """Absolute path to the plugins directory. 702 703 :since: 1.0.11 704 """ 705 return self._get_path_to_dir('plugins') 706 707 @lazy 708 def templates_dir(self): 709 """Absolute path to the templates directory. 710 711 :since: 1.0.11 712 """ 713 return self._get_path_to_dir('templates') 714 659 715 def get_templates_dir(self): 660 """Return absolute path to the templates directory.""" 716 """Return absolute path to the templates directory. 717 718 :since 1.0.11: Deprecated and will be removed in 1.3.1. Use the 719 `templates_dir` property instead. 720 """ 661 721 return self._get_path_to_dir('templates') 662 663 def get_htdocs_dir(self):664 """Return absolute path to the htdocs directory."""665 return self._get_path_to_dir('htdocs')666 667 def get_log_dir(self):668 """Return absolute path to the log directory."""669 return self._get_path_to_dir('log')670 671 def get_plugins_dir(self):672 """Return absolute path to the plugins directory."""673 return self._get_path_to_dir('plugins')674 722 675 723 def setup_log(self): … … 679 727 logfile = self.log_file 680 728 if logtype == 'file' and not os.path.isabs(logfile): 681 logfile = os.path.join(self. get_log_dir(), logfile)729 logfile = os.path.join(self.log_dir, logfile) 682 730 format = self.log_format 683 731 logid = 'Trac.%s' % sha1(self.path).hexdigest() … … 841 889 842 890 def _update_sample_config(self): 843 filename = os.path.join(self.env. path, 'conf', 'trac.ini.sample')891 filename = os.path.join(self.env.conf_dir, 'trac.ini.sample') 844 892 if not os.path.isfile(filename): 845 893 return -
branches/1.0-stable/trac/loader.py
r14613 r14637 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 -
branches/1.0-stable/trac/tests/functional/testcases.py
r14303 r14637 46 46 env.config.set('components', 'RaiseExceptionPlugin.*', 'enabled') 47 47 env.config.save() 48 create_file(os.path.join(env.path, 'plugins', 49 'RaiseExceptionPlugin.py'), 48 create_file(os.path.join(env.plugins_dir, 'RaiseExceptionPlugin.py'), 50 49 """\ 51 50 from trac.core import Component, implements … … 90 89 """Test for regression of the plugin reload fix in r6017""" 91 90 # Setup the DeleteTicket plugin 91 env = self._testenv.get_trac_environment() 92 92 plugin = open(os.path.join(self._testenv.trac_src, 93 93 'sample-plugins', 'workflow', 94 94 'DeleteTicket.py')).read() 95 open(os.path.join(self._testenv.tracdir, 'plugins', 96 'DeleteTicket.py'), 'w').write(plugin) 97 env = self._testenv.get_trac_environment() 95 plugin_path = os.path.join(env.plugins_dir, 'DeleteTicket.py') 96 open(plugin_path, 'w').write(plugin) 98 97 prevconfig = env.config.get('ticket', 'workflow') 99 98 env.config.set('ticket', 'workflow', … … 114 113 env.config.save() 115 114 for ext in ('py', 'pyc', 'pyo'): 116 filename = os.path.join( self._testenv.tracdir, 'plugins',115 filename = os.path.join(env.plugins_dir, 117 116 'DeleteTicket.%s' % ext) 118 117 if os.path.exists(filename): … … 123 122 def runTest(self): 124 123 """Test for regression of http://trac.edgewall.org/ticket/3833 a""" 124 env = self._testenv.get_trac_environment() 125 125 # Assume the logging is already set to debug. 126 traclogfile = open(os.path.join(self._testenv.tracdir, 'log', 127 'trac.log')) 126 traclogfile = open(os.path.join(env.log_dir, 'trac.log')) 128 127 # Seek to the end of file so we only look at new log output 129 128 traclogfile.seek(0, 2) 129 130 130 # Verify that logging is on initially 131 env = self._testenv.get_trac_environment()132 133 131 env.log.debug("RegressionTestTicket3833 debug1") 134 132 debug1 = traclogfile.read() … … 143 141 # Turn logging off, try to log something, and verify that it does 144 142 # not show up. 145 traclogfile = open(os.path.join(self._testenv.tracdir, 'log',146 'trac.log'))143 env = self._testenv.get_trac_environment() 144 traclogfile = open(os.path.join(env.log_dir, 'trac.log')) 147 145 # Seek to the end of file so we only look at new log output 148 146 traclogfile.seek(0, 2) 149 env = self._testenv.get_trac_environment()150 147 151 148 env.config.set('logging', 'log_level', 'INFO') … … 167 164 # Turn logging back on, try to log something, and verify that it 168 165 # does show up. 169 traclogfile = open(os.path.join(self._testenv.tracdir, 'log',170 'trac.log'))166 env = self._testenv.get_trac_environment() 167 traclogfile = open(os.path.join(env.log_dir, 'trac.log')) 171 168 # Seek to the end of file so we only look at new log output 172 169 traclogfile.seek(0, 2) 173 env = self._testenv.get_trac_environment()174 170 175 171 env.config.set('logging', 'log_level', 'DEBUG') … … 309 305 env.config.set('components', 'RaiseExceptionPlugin.*', 'enabled') 310 306 env.config.save() 311 create_file(os.path.join(env.p ath, 'plugins', 'RaiseExceptionPlugin.py'),307 create_file(os.path.join(env.plugins_dir, 'RaiseExceptionPlugin.py'), 312 308 """\ 313 309 from trac.core import Component, implements -
branches/1.0-stable/trac/tests/functional/testenv.py
r13591 r14637 345 345 env.config.set('trac', 'permission_policies', 346 346 'AuthzPolicy, ' + permission_policies) 347 authz_file = self.tracdir + '/conf/' + filename347 authz_file = os.path.join(env.conf_dir, filename) 348 348 if isinstance(authz_content, basestring): 349 349 authz_content = [line.strip() for line in -
branches/1.0-stable/trac/ticket/tests/functional.py
r14480 r14637 129 129 env.config.set('components', plugin_name + '.*', 'enabled') 130 130 env.config.save() 131 create_file(os.path.join(env.p ath, 'plugins', plugin_name + '.py'),131 create_file(os.path.join(env.plugins_dir, plugin_name + '.py'), 132 132 """\ 133 133 from genshi.builder import tag … … 1894 1894 """Test for regression of http://trac.edgewall.org/ticket/6048""" 1895 1895 # Setup the DeleteTicket plugin 1896 env = self._testenv.get_trac_environment() 1896 1897 plugin = open(os.path.join(self._testenv.trac_src, 'sample-plugins', 1897 1898 'workflow', 'DeleteTicket.py')).read() 1898 open(os.path.join(self._testenv.tracdir, 'plugins', 1899 'DeleteTicket.py'), 'w').write(plugin) 1900 env = self._testenv.get_trac_environment() 1899 plugin_path = os.path.join(env.plugins_dir, 'DeleteTicket.py') 1900 open(plugin_path, 'w').write(plugin) 1901 1901 prevconfig = env.config.get('ticket', 'workflow') 1902 1902 env.config.set('ticket', 'workflow', … … 1924 1924 env = self._testenv.get_trac_environment() # reload environment 1925 1925 for ext in ('py', 'pyc', 'pyo'): 1926 filename = os.path.join(self._testenv.tracdir, 'plugins', 1927 'DeleteTicket.%s' % ext) 1926 filename = os.path.join(env.plugins_dir, 'DeleteTicket.%s' % ext) 1928 1927 if os.path.exists(filename): 1929 1928 os.unlink(filename) -
branches/1.0-stable/trac/web/chrome.py
r14480 r14637 703 703 return [('common', pkg_resources.resource_filename('trac', 'htdocs')), 704 704 ('shared', self.shared_htdocs_dir), 705 ('site', self.env. get_htdocs_dir())]705 ('site', self.env.htdocs_dir)] 706 706 707 707 def get_templates_dirs(self): 708 708 return filter(None, [ 709 self.env. get_templates_dir(),709 self.env.templates_dir, 710 710 self.shared_templates_dir, 711 711 pkg_resources.resource_filename('trac', 'templates'), … … 1146 1146 files = {} 1147 1147 # Collect templates list 1148 site_templates = list_dir(self.env. get_templates_dir(), '.html')1148 site_templates = list_dir(self.env.templates_dir, '.html') 1149 1149 shared_templates = list_dir(Chrome(self.env).shared_templates_dir, 1150 1150 '.html') 1151 1151 1152 1152 # Collect static resources list 1153 site_htdocs = list_dir(self.env. get_htdocs_dir())1153 site_htdocs = list_dir(self.env.htdocs_dir) 1154 1154 shared_htdocs = list_dir(Chrome(self.env).shared_htdocs_dir) 1155 1155 -
branches/1.0-stable/trac/wiki/tests/functional.py
r13874 r14637 58 58 env.config.set('components', plugin_name + '.*', 'enabled') 59 59 env.config.save() 60 create_file(os.path.join(env.path, 'plugins', 61 plugin_name + '.py'), """\ 60 create_file(os.path.join(env.plugins_dir, plugin_name + '.py'), """\ 62 61 from genshi.builder import tag 63 62 from trac.core import Component, implements
Note: See TracChangeset
for help on using the changeset viewer.
