1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

better fix: use %(mapping keys)s in templates

This commit is contained in:
Michal Marek 2008-03-07 09:13:30 +00:00
parent ad2493d496
commit 3613893199
2 changed files with 18 additions and 12 deletions

View File

@ -277,12 +277,16 @@ class Osc(cmdln.Cmdln):
edit_meta(metatype='prj',
edit=True,
path_args=quote_plus(project),
template_args=(project, conf.config['user'], conf.config['user']))
template_args=({
'name': project,
'user': conf.config['user']}))
elif cmd == 'pkg':
edit_meta(metatype='pkg',
edit=True,
path_args=(quote_plus(project), quote_plus(package)),
template_args=(package, conf.config['user'], conf.config['user']))
template_args=({
'name': package,
'user': conf.config['user']}))
elif cmd == 'prjconf':
edit_meta(metatype='prjconf',
edit=True,
@ -292,7 +296,7 @@ class Osc(cmdln.Cmdln):
edit_meta(metatype='user',
edit=True,
path_args=(quote_plus(user)),
template_args=(user, user))
template_args=({'user': user}))
elif cmd == 'pattern':
edit_meta(metatype='pattern',
edit=True,
@ -1866,7 +1870,9 @@ class Osc(cmdln.Cmdln):
os.chdir(os.path.join(project_dir, pac))
data = meta_exists(metatype='pkg',
path_args=(quote_plus(project), quote_plus(pac)),
template_args=(pac, conf.config['user']))
template_args=({
'name': pac,
'user': conf.config['user']}))
if data:
data = ET.fromstring(''.join(data))
data.find('title').text = title

View File

@ -28,7 +28,7 @@ exclude_stuff = [store, '.svn', 'CVS', '.git', '.gitignore', '.pc', '*~', '.*.sw
new_project_templ = """\
<project name="%s">
<project name="%(name)s">
<title>Short title of NewProject</title>
@ -37,8 +37,8 @@ new_project_templ = """\
It also does some weird stuff.
</description>
<person role="maintainer" userid="%s" />
<person role="bugowner" userid="%s" />
<person role="maintainer" userid="%(user)s" />
<person role="bugowner" userid="%(user)s" />
<!-- remove this block to publish your packages on the mirrors -->
<publish>
@ -89,7 +89,7 @@ It also does some weird stuff.
"""
new_package_templ = """\
<package name="%s">
<package name="%(name)s">
<title>Title of New Package</title>
@ -98,8 +98,8 @@ GOES
HERE
</description>
<person role="maintainer" userid="%s"/>
<person role="bugowner" userid="%s"/>
<person role="maintainer" userid="%(user)s"/>
<person role="bugowner" userid="%(user)s"/>
<!--
@ -118,11 +118,11 @@ HERE
new_user_template = """\
<person>
<login>%s</login>
<login>%(user)s</login>
<email>PUT_EMAIL_ADDRESS_HERE</email>
<realname>PUT_REAL_NAME_HERE</realname>
<watchlist>
<project name="home:%s"/>
<project name="home:%(user)s"/>
</watchlist>
</person>
"""