mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 18:26:15 +01:00
better fix: use %(mapping keys)s in templates
This commit is contained in:
parent
ad2493d496
commit
3613893199
@ -277,12 +277,16 @@ class Osc(cmdln.Cmdln):
|
|||||||
edit_meta(metatype='prj',
|
edit_meta(metatype='prj',
|
||||||
edit=True,
|
edit=True,
|
||||||
path_args=quote_plus(project),
|
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':
|
elif cmd == 'pkg':
|
||||||
edit_meta(metatype='pkg',
|
edit_meta(metatype='pkg',
|
||||||
edit=True,
|
edit=True,
|
||||||
path_args=(quote_plus(project), quote_plus(package)),
|
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':
|
elif cmd == 'prjconf':
|
||||||
edit_meta(metatype='prjconf',
|
edit_meta(metatype='prjconf',
|
||||||
edit=True,
|
edit=True,
|
||||||
@ -292,7 +296,7 @@ class Osc(cmdln.Cmdln):
|
|||||||
edit_meta(metatype='user',
|
edit_meta(metatype='user',
|
||||||
edit=True,
|
edit=True,
|
||||||
path_args=(quote_plus(user)),
|
path_args=(quote_plus(user)),
|
||||||
template_args=(user, user))
|
template_args=({'user': user}))
|
||||||
elif cmd == 'pattern':
|
elif cmd == 'pattern':
|
||||||
edit_meta(metatype='pattern',
|
edit_meta(metatype='pattern',
|
||||||
edit=True,
|
edit=True,
|
||||||
@ -1866,7 +1870,9 @@ class Osc(cmdln.Cmdln):
|
|||||||
os.chdir(os.path.join(project_dir, pac))
|
os.chdir(os.path.join(project_dir, pac))
|
||||||
data = meta_exists(metatype='pkg',
|
data = meta_exists(metatype='pkg',
|
||||||
path_args=(quote_plus(project), quote_plus(pac)),
|
path_args=(quote_plus(project), quote_plus(pac)),
|
||||||
template_args=(pac, conf.config['user']))
|
template_args=({
|
||||||
|
'name': pac,
|
||||||
|
'user': conf.config['user']}))
|
||||||
if data:
|
if data:
|
||||||
data = ET.fromstring(''.join(data))
|
data = ET.fromstring(''.join(data))
|
||||||
data.find('title').text = title
|
data.find('title').text = title
|
||||||
|
16
osc/core.py
16
osc/core.py
@ -28,7 +28,7 @@ exclude_stuff = [store, '.svn', 'CVS', '.git', '.gitignore', '.pc', '*~', '.*.sw
|
|||||||
|
|
||||||
|
|
||||||
new_project_templ = """\
|
new_project_templ = """\
|
||||||
<project name="%s">
|
<project name="%(name)s">
|
||||||
|
|
||||||
<title>Short title of NewProject</title>
|
<title>Short title of NewProject</title>
|
||||||
|
|
||||||
@ -37,8 +37,8 @@ new_project_templ = """\
|
|||||||
It also does some weird stuff.
|
It also does some weird stuff.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<person role="maintainer" userid="%s" />
|
<person role="maintainer" userid="%(user)s" />
|
||||||
<person role="bugowner" userid="%s" />
|
<person role="bugowner" userid="%(user)s" />
|
||||||
|
|
||||||
<!-- remove this block to publish your packages on the mirrors -->
|
<!-- remove this block to publish your packages on the mirrors -->
|
||||||
<publish>
|
<publish>
|
||||||
@ -89,7 +89,7 @@ It also does some weird stuff.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
new_package_templ = """\
|
new_package_templ = """\
|
||||||
<package name="%s">
|
<package name="%(name)s">
|
||||||
|
|
||||||
<title>Title of New Package</title>
|
<title>Title of New Package</title>
|
||||||
|
|
||||||
@ -98,8 +98,8 @@ GOES
|
|||||||
HERE
|
HERE
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<person role="maintainer" userid="%s"/>
|
<person role="maintainer" userid="%(user)s"/>
|
||||||
<person role="bugowner" userid="%s"/>
|
<person role="bugowner" userid="%(user)s"/>
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
@ -118,11 +118,11 @@ HERE
|
|||||||
|
|
||||||
new_user_template = """\
|
new_user_template = """\
|
||||||
<person>
|
<person>
|
||||||
<login>%s</login>
|
<login>%(user)s</login>
|
||||||
<email>PUT_EMAIL_ADDRESS_HERE</email>
|
<email>PUT_EMAIL_ADDRESS_HERE</email>
|
||||||
<realname>PUT_REAL_NAME_HERE</realname>
|
<realname>PUT_REAL_NAME_HERE</realname>
|
||||||
<watchlist>
|
<watchlist>
|
||||||
<project name="home:%s"/>
|
<project name="home:%(user)s"/>
|
||||||
</watchlist>
|
</watchlist>
|
||||||
</person>
|
</person>
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user