Skip to content

Instantly share code, notes, and snippets.

@sleinen
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sleinen/31c5615974e709f5f114 to your computer and use it in GitHub Desktop.
Save sleinen/31c5615974e709f5f114 to your computer and use it in GitHub Desktop.
<!-- UPDATE: jpich on #openstack-horizon pointed me to
https://bugs.launchpad.net/horizon/+bug/1332238
Thanks!
So this is a known issue, and as I suspected there seems to be a
more credible fix than my hack below. I'll try to search
Launchpad more thoroughly next time.
------------------------------
https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/volumes/templates/volumes/volumes/_limits.html
is the template that generates the pop-up box that is shown when
you "Create a Volume" from the OpenStack dashboard's "Volumes"
section (horizon/project/volumes/create/).
We have an OpenStack Icehouse cluster on which this template
generates bogus expension text, about which users have started to
complain.
This *may* be a problem with the Horizon code.
If you know this code, or Django, please help me understand.
original code from Icehouse: -->
<p>{{ usages.maxTotalVolumeGigabytes|quota:_("GB")|intcomma }}</p>
<!-- On our cluster, this generates (Exhibit A) the b0rked text of
Volume Limits
Total Gigabytes (0 GB) 1,000 <django.utils.functional.__proxy__ object at 0x7ff74045d350> Available
-->
<!-- modified code with "intcomma" and "quota" filters inversed -->
<p>{{ usages.maxTotalVolumeGigabytes|intcomma|quota:_("GB") }}</p>
<!-- On our cluster, this generates (Exhibit B) the correct text of
Volume Limits
Total Gigabytes (0 GB) 1,000 GB Available
Can anyone explain this to me?
What exactly is the "quota" filter supposed do when decorated
with an argument? Where is it defined in the source?
How can it happen that an internal Python object gets expanded
into the text instead of the string "GB"?
Is my change (inverting the intcomma and quota filters) a
proper fix for my problem? I cannot believe it is, although
it does fix it for me. But if it is, it should probably be
applied elsewhere.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment