Skip to content

Commit

Permalink
Add processing for 'project-type' in zanata.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesni committed Sep 20, 2011
1 parent f0ca846 commit 57efa1a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion zanataclient/parseconfig.py
Expand Up @@ -28,7 +28,7 @@
from zanatalib.logger import Logger
from xml.dom import minidom

project_config = {'project_url':'', 'project_id':'', 'project_version':'', 'locale_map':{}}
project_config = {'project_url':'', 'project_id':'', 'project_version':'', 'project_type':'', 'locale_map':{}}


class ZanataConfig:
Expand Down Expand Up @@ -108,6 +108,16 @@ def read_project_config(self, filename):
rc = rc + node.data
project_config['project_version'] = rc

#Read the project-type
if xmldoc.getElementsByTagName("project-type"):
node = xmldoc.getElementsByTagName("project-type")[0]
rc = ""

for node in node.childNodes:
if node.nodeType in ( node.TEXT_NODE, node.CDATA_SECTION_NODE):
rc = rc + node.data
project_config['project_type'] = rc

#Read the locale map
if xmldoc.getElementsByTagName("locales"):
locales = xmldoc.getElementsByTagName("locales")[0]
Expand Down
2 changes: 2 additions & 0 deletions zanataclient/zanata.py
Expand Up @@ -1034,6 +1034,8 @@ def push(command_options, args, project_type = None):

if command_options.has_key('project_type'):
command_type = command_options['project_type'][0]['value']
elif project_config['project_type']:
command_type = project_config['project_type']
else:
log.error("The project type is unknown")
sys.exit(1)
Expand Down

0 comments on commit 57efa1a

Please sign in to comment.