Comment 2 for bug 969162

Revision history for this message
Tihomir Trifonov (ttrifonov) wrote :

Also found a nasty bug...

In volume details template, for 'Created at' is used:

    <dt>{% trans "Created" %}</dt>
    <dd>{{ volume.createdAt|parse_date }}</dd>

But the actual property here is volume.created_at. The real problem comes when this is rendered in the template, it goes to nova-client, but as the property is not present in the current object, it tries to do a lazy load:

    def __getattr__(self, k):
        if k not in self.__dict__:
            #NOTE(bcwaldon): disallow lazy-loading if already loaded once
            if not self.is_loaded():
                self.get()
                return self.__getattr__(k)

And this reloads the whole object, thus discarding some modifications we've made to the object in tab.get_context_data() method. This is very dangerous behaviour, as allows for an object to change it's state during template rendering if a property name is mispelled...