Merge lp:~jakedahn/django-nova/imagefixes into lp:django-nova

Proposed by Jake Dahn
Status: Merged
Approved by: Devin Carlen
Approved revision: 17
Merged at revision: 18
Proposed branch: lp:~jakedahn/django-nova/imagefixes
Merge into: lp:django-nova
Diff against target: 37 lines (+2/-3)
3 files modified
src/django_nova/templates/django_nova/images/_list.html (+1/-1)
src/django_nova/templates/django_nova/images/detail_list.html (+1/-1)
src/django_nova/views/images.py (+0/-1)
To merge this branch: bzr merge lp:~jakedahn/django-nova/imagefixes
Reviewer Review Type Date Requested Status
Devin Carlen Approve
Jake Dahn (community) Approve
Review via email: mp+51454@code.launchpad.net

Description of the change

When trying to load image detail url (/project/foo/images/ami-foo/detail) this error occurs:

'Image' object has no attribute 'displayName'

__

The error was caused by forms.UpdateImageForm being passed into the render block, removing this fixes the bug. The detail view is for looking at more details of an image image, there is no need for the form.

Also changed the templates so if displayName is not set it will display the image id in its place.

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
Devin Carlen (devcamcar) wrote :

Code looks fine. Two points of order nits:

1) please add a better description of the change. only referencing the bug # is insufficient.

2) in the future, please use the lp bug # as the branch name, a la lpXXXXXX

review: Needs Fixing
Revision history for this message
Devin Carlen (devcamcar) wrote :

Actually now that I look at this again, something seems to not add up.

If the ami didn't have a "displayName" property, you wouldn't get the error you described in the bug. When django has an error in a {{ }} tag, it just renders an empty string. This is a django "feature".

So I suspect the error is coming from somewhere else? Did you have a good repro case for this?

review: Needs Information
Revision history for this message
Jake Dahn (jakedahn) wrote :

> Code looks fine. Two points of order nits:
>
> 1) please add a better description of the change. only referencing the bug #
> is insufficient.
>
> 2) in the future, please use the lp bug # as the branch name, a la lpXXXXXX

1. Updated description.
2. Right-o, still adapting to launchpad.

Revision history for this message
Jake Dahn (jakedahn) wrote :

> Actually now that I look at this again, something seems to not add up.
>
> If the ami didn't have a "displayName" property, you wouldn't get the error
> you described in the bug. When django has an error in a {{ }} tag, it just
> renders an empty string. This is a django "feature".
>
> So I suspect the error is coming from somewhere else? Did you have a good
> repro case for this?

As stated in the updated branch description the error was caused by forms.UpdateImageForm being passed into the render block. Removing said form fixed the error.

The placement of displayName inside of the templates was showing up blank when it was empty, which is inconsistent with the rest of the fields (for example description says 'none' when it is blank). The name field shouldn't say 'none' because a user may mistake that for the image name. So in place it now says the ami ID.

review: Needs Resubmitting
Revision history for this message
Jake Dahn (jakedahn) :
review: Approve
Revision history for this message
Devin Carlen (devcamcar) wrote :

approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/django_nova/templates/django_nova/images/_list.html'
--- src/django_nova/templates/django_nova/images/_list.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/django_nova/images/_list.html 2011-02-27 11:46:31 +0000
@@ -34,7 +34,7 @@
34 </div>34 </div>
35 <div class="image_detail_item">35 <div class="image_detail_item">
36 <span class="label">Name: </span>36 <span class="label">Name: </span>
37 <span class="data">{{ ami.displayName }}</span>37 <span class="data">{% if ami.displayName %}{{ ami.displayName }}{%else%}{{ ami.id }}{% endif %}</span>
38 </div>38 </div>
39 <div class="image_detail_item">39 <div class="image_detail_item">
40 <span class="label">Type: </span>40 <span class="label">Type: </span>
4141
=== modified file 'src/django_nova/templates/django_nova/images/detail_list.html'
--- src/django_nova/templates/django_nova/images/detail_list.html 2011-01-16 21:28:02 +0000
+++ src/django_nova/templates/django_nova/images/detail_list.html 2011-02-27 11:46:31 +0000
@@ -52,7 +52,7 @@
52 </div>52 </div>
53 <div class="image_detail_item">53 <div class="image_detail_item">
54 <span class="label">Name: </span>54 <span class="label">Name: </span>
55 <span class="data">{{ ami.displayName }}</span>55 <span class="data">{% if ami.displayName %}{{ ami.displayName }}{%else%}{{ ami.id }}{% endif %}</span>
56 </div>56 </div>
57 <div class="image_detail_item">57 <div class="image_detail_item">
58 <span class="label">Type: </span>58 <span class="label">Type: </span>
5959
=== modified file 'src/django_nova/views/images.py'
--- src/django_nova/views/images.py 2011-01-31 20:08:02 +0000
+++ src/django_nova/views/images.py 2011-02-27 11:46:31 +0000
@@ -120,7 +120,6 @@
120 raise http.Http404()120 raise http.Http404()
121 return render_to_response('django_nova/images/index.html', {121 return render_to_response('django_nova/images/index.html', {
122 'form': forms.LaunchInstanceForm(project),122 'form': forms.LaunchInstanceForm(project),
123 'update_form': forms.UpdateImageForm(ami),
124 'region': project.region,123 'region': project.region,
125 'project': project,124 'project': project,
126 'images': images,125 'images': images,

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: