Opened 3 years ago

Closed 3 years ago

# cannot create a new hack

Reported by: Owned by: ryepup rjollos normal TracHacks normal jun66j5

### 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?

### comment:1 Changed 3 years ago by rjollos

• Owner changed from otaku42 to rjollos
• Status changed from new to assigned

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.

### comment:2 Changed 3 years ago by rjollos

• Cc jun66j5 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 3 years ago by rjollos

Ah, I guess I need to set TRACHACKS_SVN_CONFIG_DIR in the environment.

### comment:4 follow-up: ↓ 5 Changed 3 years ago by 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:

• ## trachacks/web_ui.py

diff --git a/trachacks/web_ui.py b/trachacks/web_ui.py
index cb277d3..83d7ff5 100644
 a from trac.wiki.macros import WikiMacroBase from trac.wiki.model import WikiPage from trac.util.compat import sorted from trac.util.translation import tag_ from trac.versioncontrol.api import RepositoryManager from trac.web.api import ( IRequestFilter, IRequestHandler, ITemplateStreamFilter, RequestDone ) class TracHacksHandler(Component): env = os.environ.copy() env['LC_ALL'] = env['LANG'] = 'en_US.UTF-8' svn_path = 'file://%s' % self.config.get('trac', 'repository_dir') rm = RepositoryManager(self.env) repos = rm.get_all_repositories()[''] svn_path = 'file://%s' % repos['dir'] svn_path = svn_path.rstrip('/') paths = ['%s/%s' % (svn_path, hack_path)] 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 in reply to: ↑ 4 Changed 3 years ago by jun66j5

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 the url from the database as well, and drop the [trachacks] subversion_base_url configuration option.

That sounds good.

Proposed changes in https://github.com/jun66j5/trachacksplugin/compare/t11436.

Last edited 3 years ago by jun66j5 (previous) (diff)

### comment:6 Changed 3 years ago by rjollos

In 13488:

Fixed error for default repository defined in a DbRepositoryProvider rather than trac.ini. Refs #11436. Patch by Jun Omae.

• Retrieve the default repository using Environment.get_repository() rather than trac.ini
• Retrieve url of the new hack using Repository.get_path_url() and removed [trachacks] subversion_base_url option

### comment:7 Changed 3 years ago by rjollos

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:8 follow-up: ↓ 9 Changed 3 years ago by jun66j5

Thanks! Oh, I'd like to try to publishing.

### comment:9 in reply to: ↑ 8 Changed 3 years ago by jun66j5

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:10 Changed 3 years ago by rjollos

Sorry about that. You should have the permission now.

### comment:11 follow-up: ↓ 12 Changed 3 years ago by jun66j5

I registered new hacks. Then, I found two issues.

• Ignore Installation instructions in the form.
• The hack type and author name automatically are not tagged.
Last edited 3 years ago by jun66j5 (previous) (diff)

### comment:12 in reply to: ↑ 11 ; follow-up: ↓ 18 Changed 3 years ago by jun66j5

I registered new hacks. Then, I found two issues.

• Ignore Installation instructions in the form.
• The hack type and author 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 You can check out ${WIKINAME} from [${SOURCEURL} here] using Subversion, or [source:${LCNAME} browse the source] with Trac. == Example == == Installation ==${EXAMPLE} \${INSTALLATION} == Recent Changes ==

### comment:13 Changed 3 years ago by rjollos

In 13507:

Pass "installation" parameter to template data. Append author name to tags. Refs #11436.

Patch by Jun Omae.

### comment:14 follow-up: ↓ 16 Changed 3 years ago by rjollos

In 13508:

Fixed invalid value for -moz-background-clip property. Refs #11436.

### comment:15 Changed 3 years ago by rjollos

In 13509:

Moved macros to macros.py and utility functions to util.py. Refs #11436.

### comment:16 in reply to: ↑ 14 Changed 3 years ago by jun66j5

In 13508:

Fixed invalid value for -moz-background-clip property. Refs #11436.

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:17 Changed 3 years ago by rjollos

In 13511:

Remove rules for which the initial value is specified. Refs #11436.

Patch by Jun Omae.

### comment:18 in reply to: ↑ 12 Changed 3 years ago by rjollos

Also, the following should be applied to NewHackTemplate.

### comment:19 Changed 3 years ago by rjollos

• Resolution set to fixed
• Status changed from assigned to closed

r13509 has been deployed to trac-hacks.org and authenticated users now have the HACK_CREATE permission.

ryepup: You should be able to create a hack now.

Posted some news:

### comment:20 follow-up: ↓ 21 Changed 3 years ago by jun66j5

Thanks, Ryan!

BTW, NewHack wiki page is still existent. I think we should remove the page or make a newhack link in the page. I cannot modify the page which is read only.

### comment:21 in reply to: ↑ 20 Changed 3 years ago by rjollos

BTW, NewHack wiki page is still existent. I think we should remove the page or make a newhack link in the page. I cannot modify the page which is read only.

Thanks, I added a redirect there just now.