Possible bug when adding a new category to Cartridge shop?

36 views
Skip to first unread message

Lex Hider

unread,
Jan 12, 2011, 12:30:38 AM1/12/11
to mezzani...@googlegroups.com, josh.d...@citrus.com.au
We're getting the following error message when we try to add a new
category to Cartridge shop.

Any ideas?

Looks like we're trying to access a dictionary item that doesn't exist?

This is what I get when setting a set_trace() at line 84 of pages/admin.py.

[12/Jan/2011 16:27:29] "POST /mezzanine/admin_keywords_submit/ HTTP/1.1" 200 0
> /home/ahider/VirtEnvs/cart/lib/python2.6/site-packages/mezzanine/pages/admin.py(85)_maintain_parent()
-> location = response._headers["location"][1]
(Pdb) response._headers
{'content-type': ('Content-Type', 'text/html; charset=utf-8')}
(Pdb)


Lex.

CartError.png

Stephen McDonald

unread,
Jan 12, 2011, 4:53:14 PM1/12/11
to mezzani...@googlegroups.com
Thanks for finding this Lex.

This is fixed and included in 0.10.1 which is now up on github, bitbucket and pypi.

When you add/edit non-primary pages in Mezzanine, the parent page ID is passed around in the querystring which the code in question tries to handle. It assumes that a redirect always occurs (which adds the location header) after add/edit. However when adding a page via a popup window, as is the case when clicking the add button from a foreign key field (such as the category field when editing a product) a redirect doesn't occur and the popup just closes the window, so in this case there is no location header and the codes breaks.

So the fix was to simply check for this previously unhandled situation.

Cheers,
Steve
--
Stephen McDonald

Josh deBlank

unread,
Jan 12, 2011, 4:59:38 PM1/12/11
to mezzani...@googlegroups.com

Any reason why categories is not in the main nav? I found it hard to find where to add, edit categories (apart from where the afore mentioned bug was found)

Cheers
Josh

==================
Sent from my nexus1.

Stephen McDonald

unread,
Jan 12, 2011, 5:27:31 PM1/12/11
to mezzani...@googlegroups.com
Well like forms or any custom content type, they're implemented as Mezzanine "pages" so that they can appear anywhere within the navigation tree. So it's all under the "pages" section in the admin and from within the navigation tree there, you choose whichever type of page you'd like to add, such as a category or a form or whatever the developer has implemented as custom content types for the particular project.

So the reasoning for this is to give the ability to have any kind of category hierarchy you like - categories, sub categories, sub sub categories, whatever. And these can appear anywhere within the navigation. The main idea here is that categories are hierarchical and not a linear list of items like a blog for example.

You're right though in as much as this isn't obvious for a first-time admin user, so perhaps the name "pages" could be more indicative of the fact it's responsible for a whole bunch of different types of content. Perhaps it could be called "Navigation Tree". 

Cheers,
Steve
Reply all
Reply to author
Forward
0 new messages