diff options
-rw-r--r-- | db.py | 3 | ||||
-rwxr-xr-x | fbin.py | 2 | ||||
-rw-r--r-- | templates/images.tmpl | 2 | ||||
-rw-r--r-- | templates/my.tmpl | 2 |
4 files changed, 7 insertions, 2 deletions
@@ -51,6 +51,9 @@ class File(Base): def get_path(self): return os.path.join(settings.file_directory, self.hash + os.path.splitext(self.filename)[1]) + def get_size(self): + return os.path.getsize(self.get_path()) + def html(self): return u'<a href="{root}f/{hash}/{filename}">{filename}</a> ' \ '<sup><a href="{root}f/{hash}">1</a> <a href="{root}f/{hash}{ext}">2</a></sup> ({size}) on {date}'.format( @@ -356,6 +356,7 @@ class Application(object): 'root': settings.virtual_root, 'user': user, 'files': files, + 'total_size': db.File.pretty_size(sum([f.get_size() for f in files])), })) def images(self, environ, start_response, path): @@ -370,6 +371,7 @@ class Application(object): 'root': settings.virtual_root, 'user': user, 'files': files, + 'total_size': db.File.pretty_size(sum([f.get_size() for f in files])), })) def thumb(self, environ, start_response, path): diff --git a/templates/images.tmpl b/templates/images.tmpl index 34c8e78..4cd3752 100644 --- a/templates/images.tmpl +++ b/templates/images.tmpl @@ -2,7 +2,7 @@ #def header: images #extends templates.base #def content -<p>Your uploaded images:</p> +<p>You have $len($files) uploaded images totaling $total_size.</p> <ul class="image-list"> #for file in $files <li>$file.image_html</li> diff --git a/templates/my.tmpl b/templates/my.tmpl index b1fb2cc..7e6e242 100644 --- a/templates/my.tmpl +++ b/templates/my.tmpl @@ -2,7 +2,7 @@ #def header: myfiles #extends templates.base #def content -<p>Your uploads:</p> +<p>You have $len($files) uploaded files totaling $total_size.</p> <ul> #for file in $files <li>$file.html</li> |