Browse Source

Use builtin filter for file size formatting

Matthias Vogelgesang 7 years ago
parent
commit
48e1b328ad
3 changed files with 1 additions and 14 deletions
  1. 0 11
      nova/__init__.py
  2. 1 2
      nova/templates/dataset/detail.html
  3. 0 1
      requirements.txt

+ 0 - 11
nova/__init__.py

@@ -1,5 +1,4 @@
 import os
-import humanize
 import jinja2
 from flask import Flask
 from flask_login import LoginManager, current_user
@@ -23,16 +22,6 @@ app.config['NOVA_FS_LAYOUT'] = jinja2.Template('{{ root }}/{{ user }}/{{ dataset
 app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(app.config['NOVA_ROOT_PATH'], 'nova.db')
 
 
-@app.template_filter('naturaltime')
-def naturaltime(t):
-    return humanize.naturaltime(t)
-
-
-@app.template_filter('naturalsize')
-def naturalsize(s):
-    return humanize.naturalsize(int(s))
-
-
 @app.template_filter('group')
 def group(l, n):
     for i in range(0, len(l), n):

+ 1 - 2
nova/templates/dataset/detail.html

@@ -155,7 +155,7 @@
     {% for filename, filesize in files %}
     <tr>
       <td>{{ filename }}</td>
-      <td>{{ filesize | naturalsize }}</td>
+      <td>{{ filesize | filesizeformat }}</td>
     </tr>
     {% endfor %}
     </table>
@@ -163,4 +163,3 @@
 </div>
 {% endif %}
 {% endblock %}
-

+ 0 - 1
requirements.txt

@@ -1,4 +1,3 @@
-humanize
 Flask==0.11.0
 Flask-Admin
 Flask-Cache