mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-09 03:54:08 +00:00
prettySize() is not used - we are already using the |filesize template
tag, which does the same thing in a much nicer way.
This commit is contained in:
@ -4,16 +4,6 @@ from django.conf import settings
|
|||||||
|
|
||||||
from pgweb.util.helpers import template_to_string
|
from pgweb.util.helpers import template_to_string
|
||||||
|
|
||||||
def prettySize(size):
|
|
||||||
if size < 1024:
|
|
||||||
return "%s bytes" % size
|
|
||||||
suffixes = [("bytes",2**10), ("KB",2**20), ("MB",2**30), ("GB",2**40), ("TB",2**50)]
|
|
||||||
for suf, lim in suffixes:
|
|
||||||
if size > lim:
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
return "%s %s" % (round(size/float(lim/2**10),2).__str__(),suf)
|
|
||||||
|
|
||||||
def sendmail(msg):
|
def sendmail(msg):
|
||||||
pipe = Popen("sendmail -t", shell=True, stdin=PIPE).stdin
|
pipe = Popen("sendmail -t", shell=True, stdin=PIPE).stdin
|
||||||
pipe.write(msg.as_string())
|
pipe.write(msg.as_string())
|
||||||
|
Reference in New Issue
Block a user