Add the top-level comment that is now mandatory in WADL files

Change-Id: I8d24e5184403958d393f5d69bab06c485519b214
This commit is contained in:
Cyril Roelandt 2014-02-03 17:45:12 +01:00
parent 471dc8c3b4
commit a622c84b3d
1 changed files with 16 additions and 0 deletions

View File

@ -15,6 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from datetime import date
from docutils.nodes import SparseNodeVisitor, StopTraversal
import json
import os
@ -95,6 +96,21 @@ def clean_up_xml(xml_str):
# revision=1.119&view=markup
xml_str = xml_str.replace(' />', '/>')
# Add this comment right after the <?...?> line. Not sure how to do this
# using ElementTree.Comment(), since there is no parent element here.
# XXX(cyril): The starting year may not be the right one for every project.
xml_str = xml_str.replace('?>\n', '''?>
<!-- (C) 2012-%d OpenStack Foundation, All Rights Reserved -->
<!--*******************************************************-->
<!-- Import Common XML Entities -->
<!-- -->
<!-- You can resolve the entites with xmllint -->
<!-- -->
<!-- xmllint -noent os-compute-2.wadl -->
<!--*******************************************************-->
''' % date.today().year, 1)
return xml_str