Browse Source

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

No test unit suite but it was started in another commit.
Romain 5 years ago
parent
commit
2030f937aa
1 changed files with 9 additions and 2 deletions
  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: