mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-03 15:38:59 +00:00
A first very basic import.
Contains basic functionality, and an import of most of the static content from the old site. There is still plenty more to do...
This commit is contained in:
10
pgweb/util/misc.py
Normal file
10
pgweb/util/misc.py
Normal file
@ -0,0 +1,10 @@
|
||||
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)
|
||||
|
Reference in New Issue
Block a user