List Info

Thread: File size listing in cheeseshop




File size listing in cheeseshop
country flaguser name
United States
2008-02-22 08:53:21
Hi,

I'd like to report a minor display nit with the cheeseshop. 
I hope  
this is the right place.  In the cheeseshop, filesizes
listed in MB  
have the numeric portion shown as an integer (rounded down).
 It  
seems to me that it'd be more logical to either round
nearest or show  
a couple of decimal digits.

For example, the py23 egg in http://pypi.pyth
on.org/pypi/Pygments is  
listed as "1MB" but is in reality 1,832,489 bytes
(1.74MB).

Tim
_______________________________________________
Catalog-SIG mailing list
Catalog-SIGpython.org
h
ttp://mail.python.org/mailman/listinfo/catalog-sig

Re: File size listing in cheeseshop
country flaguser name
United States
2008-02-22 11:28:49
Tim,

I do not have a pypi configuration on my server anymore to
test this out but I 
think what you are asking for is a simple change to
webui.py.  There is a 
pretty_size function that handles this.  See the attached.

Joe


Tim Hatch wrote:
> Hi,
> 
> I'd like to report a minor display nit with the
cheeseshop.  I hope  
> this is the right place.  In the cheeseshop, filesizes
listed in MB  
> have the numeric portion shown as an integer (rounded
down).  It  
> seems to me that it'd be more logical to either round
nearest or show  
> a couple of decimal digits.
> 
> For example, the py23 egg in http://pypi.pyth
on.org/pypi/Pygments is  
> listed as "1MB" but is in reality 1,832,489
bytes (1.74MB).
> 
> Tim
> _______________________________________________
> Catalog-SIG mailing list
> Catalog-SIGpython.org
> h
ttp://mail.python.org/mailman/listinfo/catalog-sig
> 


_______________________________________________
Catalog-SIG mailing list
Catalog-SIGpython.org
h
ttp://mail.python.org/mailman/listinfo/catalog-sig

  
Re: File size listing in cheeseshop
country flaguser name
United States
2008-02-22 12:09:00
Joseph Armbruster wrote:
> Index: webui.py
>
============================================================
=======
> --- webui.py	(revision 524)
> +++ webui.py	(working copy)
>  -1572,9 +1572,9 
>      def pretty_size(self, size):
>          n = 0
>          while size > 1024:
> -            size /= 1024
> +            size /= 1024.0
>              n += 1
> -        return '%d%sB'%(size, ['', 'K', 'M', 'G'][n])
> +        return '%f%sB'%(size, ['', 'K', 'M', 'G'][n])


The fact that this code doesn't work for files larger than
1024 Gig 
really worries me.


;)  <-- wink for the sarcasm-challenged
-- 
Benji York
http://benjiyork.com
_______________________________________________
Catalog-SIG mailing list
Catalog-SIGpython.org
h
ttp://mail.python.org/mailman/listinfo/catalog-sig

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )