瀏覽代碼

HUE-8737 [py3] Support editing a file in File Browser

No test unit suite but it was started in another commit.
Romain 5 年之前
父節點
當前提交
2030f937aa
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      apps/filebrowser/src/filebrowser/templates/editor_components.mako

+ 9 - 2
apps/filebrowser/src/filebrowser/templates/editor_components.mako

@@ -14,7 +14,14 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 <%!
+  import sys
+
   from desktop.lib.django_util import extract_field_data
+
+  if sys.version_info[0] > 2:
+    from builtins import str as new_str
+  else:
+    new_str = unicode
 %>
 
 <%def name="render_field(
@@ -45,10 +52,10 @@
     if attributes is None:
       attributes = {}
     ret_str = ""
-    for key, value in attributes.iteritems():
+    for key, value in attributes.items():
       if key == "klass":
         key = "class"
-      ret_str += "%s='%s'" % (key.replace("_", "-"), unicode(value))
+      ret_str += "%s='%s'" % (key.replace("_", "-"), new_str(value))
     return ret_str
 
   if not attrs: