소스 검색

PR447 [oozie] Update the tests with the cleaner escaping of workflow names

Romain Rigaux 9 년 전
부모
커밋
928c6e41b3
2개의 변경된 파일6개의 추가작업 그리고 15개의 파일을 삭제
  1. 5 14
      apps/oozie/src/oozie/models2.py
  2. 1 1
      apps/oozie/src/oozie/models2_tests.py

+ 5 - 14
apps/oozie/src/oozie/models2.py

@@ -25,6 +25,7 @@ import uuid
 from datetime import datetime, timedelta
 from dateutil.parser import parse
 from string import Template
+from xml.sax.saxutils import escape
 
 from django.core.urlresolvers import reverse
 from django.db.models import Q
@@ -75,20 +76,10 @@ class Job(object):
 
   @property
   def validated_name(self):
-    xml_entities = {
-            '"': '"',
-            '\'': ''',
-            '&': '&',
-            '<': '&lt;',
-            '>': '&gt;',
-    }
-    good_name = []
-
-    for c in self.name[:40]:
-        c = xml_entities.get(c, c)
-        good_name.append(c)
-
-    return ''.join(good_name)
+    return ''.join(escape(self.name[:40], entities={
+        "'": "&apos;",
+        "\"": "&quot;"
+    }))
 
   def __str__(self):
     return '%s' % force_unicode(self.name)

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
apps/oozie/src/oozie/models2_tests.py


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.