#11436 closed defect (fixed)
cannot create a new hack
Reported by: | ryepup | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | TracHacks |
Severity: | normal | Keywords: | |
Cc: | Jun Omae | Trac Release: |
Description
I'm trying to add a new plugin, following instructions on HackProcedures.
I'm stuck at "fill out the NewHack form". When I load that page, all I see a grey link:
NewHack(NewHackTemplate)?
When I follow it, the next page says:
The page NewHack(NewHackTemplate) does not exist. You can create it here.
How do I fill in the NewHack form?
Attachments (0)
Change History (21)
comment:1 Changed 10 years ago by
Owner: | changed from Michael Renzmann to Ryan J Ollos |
---|---|
Status: | new → assigned |
comment:2 Changed 10 years ago by
Cc: | Jun Omae added; anonymous removed |
---|
Presently investigating the following issue when trying to create a hack (paths in log message have been redacted and made relative):
2013-12-18 23:08:18,810 Trac[web_ui] ERROR: Failed to create Subversion paths: svn: Local, non-commit operations do not take a log message or revision properties Traceback (most recent call last): File "... pve/lib/python2.6/site-packages/TracHacks-3.0dev_r13483-py2.6.egg/trachacks/web_ui.py", line 450, in create_hack selected_releases) File "... pve/lib/python2.6/site-packages/TracHacks-3.0dev_r13483-py2.6.egg/trachacks/web_ui.py", line 536, in _create_repository_paths (stdout, stderr)) Exception: Failed to create Subversion paths: svn: Local, non-commit operations do not take a log message or revision properties 2013-12-18 23:08:18,814 Trac[main] WARNING: [50.204.77.146] HTTPInternalError: 500 Trac Error (Failed to create Subversion paths: svn: Local, non-commit operations do not take a log message or revision properties )
comment:3 Changed 10 years ago by
Ah, I guess I need to set TRACHACKS_SVN_CONFIG_DIR
in the environment.
comment:4 follow-up: 5 Changed 10 years ago by
It looks like issue is due to default repository being configured in database rather than in trac.ini. The following patch fixes the issue, but there must be a cleaner way to implement the change:
-
trachacks/web_ui.py
diff --git a/trachacks/web_ui.py b/trachacks/web_ui.py index cb277d3..83d7ff5 100644
a b from trac.wiki.macros import WikiMacroBase 24 24 from trac.wiki.model import WikiPage 25 25 from trac.util.compat import sorted 26 26 from trac.util.translation import tag_ 27 from trac.versioncontrol.api import RepositoryManager 27 28 from trac.web.api import ( 28 29 IRequestFilter, IRequestHandler, ITemplateStreamFilter, RequestDone 29 30 ) … … class TracHacksHandler(Component): 514 515 515 516 env = os.environ.copy() 516 517 env['LC_ALL'] = env['LANG'] = 'en_US.UTF-8' 517 svn_path = 'file://%s' % self.config.get('trac', 'repository_dir') 518 rm = RepositoryManager(self.env) 519 repos = rm.get_all_repositories()[''] 520 svn_path = 'file://%s' % repos['dir'] 518 521 svn_path = svn_path.rstrip('/') 519 522 paths = ['%s/%s' % (svn_path, hack_path)] 520 523 paths.extend('%s/%s/%s' % (svn_path, hack_path, release)
I think that, ideally we'd have a configuration variable [trachacks] hacks_repository
, which would determine the repository that is retrieved. We could probably use the url
from the database as well, and drop the [trachacks] subversion_base_url
configuration option.
comment:5 Changed 10 years ago by
Replying to rjollos:
It looks like issue is due to default repository being configured in database rather than in trac.ini. The following patch fixes the issue, but there must be a cleaner way to implement the change:
We can use self.env.get_repository()
to retrieve the default repository.
I think that, ideally we'd have a configuration variable
[trachacks] hacks_repository
, which would determine the repository that is retrieved. We could probably use theurl
from the database as well, and drop the[trachacks] subversion_base_url
configuration option.
That sounds good.
-
trachacks/web_ui.py
diff --git a/trachacks/web_ui.py b/trachacks/web_ui.py index cb277d3..84d34f4 100644
a b class TracHacksHandler(Component): 166 166 'Default maximum number of hacks to display.') 167 167 template = Option('trachacks', 'template', 'NewHackTemplate', 168 168 'Name of wiki page that serves as template for new hacks.') 169 svnbase = Option('trachacks', 'subversion_base_url',170 'http://trac-hacks.org/svn',171 'Base URL of the Subversion repository.')172 169 lockfile = Option('trachacks', 'lock_file', '/var/tmp/newhack.lock', 173 170 'Path and name of lockfile to secure new hack creation') 174 171 … … class TracHacksHandler(Component): 381 378 context = self.form.validate(data) 382 379 data['form_context'] = context 383 380 381 repos = self.env.get_repository() 382 384 383 vars = {} 385 384 vars['OWNER'] = req.authname 386 385 vars['WIKINAME'] = get_page_name(data['name'], data.get('type', '')) 387 386 vars['TYPE'] = data.setdefault('type', 'plugin') 388 387 vars['TITLE'] = data.setdefault('title', 'No title available') 389 388 vars['LCNAME'] = vars['WIKINAME'].lower() 390 vars['SOURCEURL'] = '%s/%s' % (self.svnbase, vars['LCNAME']) 389 vars['SOURCEURL'] = repos.get_path_url(vars['LCNAME'], None) or \ 390 'http://localhost/svn/' + vars['LCNAME'] 391 391 vars['DESCRIPTION'] = data.setdefault('description', 392 392 'No description available') 393 393 vars['EXAMPLE'] = data.setdefault('example', … … class TracHacksHandler(Component): 514 513 515 514 env = os.environ.copy() 516 515 env['LC_ALL'] = env['LANG'] = 'en_US.UTF-8' 517 svn_path = 'file://%s' % self.config.get('trac', 'repository_dir')518 svn_path = svn_path.rstrip('/')516 repos = self.env.get_repository() 517 svn_path = ('file://%s' % repos.params['dir']).rstrip('/') 519 518 paths = ['%s/%s' % (svn_path, hack_path)] 520 519 paths.extend('%s/%s/%s' % (svn_path, hack_path, release) 521 520 for release in selected_releases
comment:7 Changed 10 years ago by
TracHacksPlugin at r13488 is installed on t-h.o and it seems to be working well. Thanks so much Jun!
It won't be available to all users until grant HACK_CREATE
permission. Jun, would you like to try publishing your latest hack before we reveal the NewHack page to all users?
comment:9 Changed 10 years ago by
Thanks! Oh, I'd like to try to publishing.
... I cannot access new hack page. That seems I have no HACK_CREATE
permission. Could you please grant it to me?
comment:11 follow-up: 12 Changed 10 years ago by
I registered new hacks. Then, I found two issues.
- Ignore Installation instructions in the form.
The hack type andauthor name automatically are not tagged.
comment:12 follow-up: 18 Changed 10 years ago by
I registered new hacks. Then, I found two issues.
- Ignore Installation instructions in the form.
The hack type andauthor name automatically are not tagged.
Proposed changes in https://github.com/jun66j5/trachacksplugin/compare/t11436.1.
Also, the following should be applied to NewHackTemplate.
-
NewHackTemplate
old new 22 22 23 23 You can check out ${WIKINAME} from [${SOURCEURL} here] using Subversion, or [source:${LCNAME} browse the source] with Trac. 24 24 25 == Example==25 == Installation == 26 26 27 ${ EXAMPLE}27 ${INSTALLATION} 28 28 29 29 == Recent Changes == 30 30
comment:16 Changed 10 years ago by
In 13508:
That seems we could remove those properties from #preview
. According to https://developer.mozilla.org/en-US/docs/Web/CSS, initial values are specified in #preview
.
property name | initial value |
background-clip | border-box |
-moz-background-inline-policy | continuous |
background-origin | padding-box |
comment:18 Changed 10 years ago by
Replying to jun66j5:
Also, the following should be applied to NewHackTemplate.
Edited in wiki:/NewHackTemplate?action=diff&version=26.
comment:19 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
It is currently offline, and being discussed in #10193. It looks like we may have a working version now, so I will test tomorrow and try to get it installed.