[arch-general] [arch-dev-public] Developer reports

Evangelos Foutras foutrelis at gmail.com
Fri Apr 29 22:24:42 EDT 2011


On 30 April 2011 04:26, Dan McGee <dpmcgee at gmail.com> wrote:
> On Fri, Apr 29, 2011 at 7:23 PM, Eric Bélanger <snowmaniscool at gmail.com> wrote:
>> 2- The report for large packages should list the sizes in MB instead of bytes.
> That would make the generic nature of these reports a lot harder,
> and/or involve me sinking quite a bit of time into making something
> generic that formats sizes. Deal with it for now. :)

filesizeformat [1] built-in filter to the rescue. However, I'm not
sure if it'll mess up the jQuery sort thingy. To run this filter for
the package compressed/installed size, the template code [2] might be
modified to something like this:

{% for attr in column_attrs %}
<td>
    {% if attr == 'compressed_size' or attr == 'installed_size' %}
    {{ pkg|attribute:attr|filesizeformat }}
    {% else %}
    {{ pkg|attribute:attr }}
    {% endif %}
</td>
{% endfor %}

[1] http://docs.djangoproject.com/en/1.3/ref/templates/builtins/#filesizeformat
[2] http://projects.archlinux.org/archweb.git/tree/templates/devel/packages.html?id=381e0a787205af530ae11bac1b1a17e567eecc84#n41


More information about the arch-general mailing list