Permalink
Browse files

Return portal_type in ContentTypeClass

Change ContentTypeClass to return contenttype-{portal_type} to match
what the rest of Plone expects. This fixes sprite based content icons
for documents/pages.
  • Loading branch information...
1 parent de4a985 commit ff5a688b122006956616380ce46665b46352e34d Gaudenz Steinlin committed Feb 9, 2012
View
@@ -4,7 +4,10 @@ Changelog
1.0.1 - Unreleased
------------------
-- Nothing changed yet.
+- Change ContentTypeClass to return contenttype-{portal_type} to match
+ what the rest of Plone expects. This fixes sprite based icons for
+ pages/documents.
+ [gaudenz]
1.0 - 2011-07-19
@@ -114,6 +114,9 @@ def CroppedDescription(self):
def Type(self):
return self._brain.Type
+ def PortalType(self):
+ return self._brain.portal_type
+
def listCreators(self):
""" """
return self._brain.listCreators
@@ -101,7 +101,7 @@ def ContentTypeClass(self):
"""A normalised type name that identifies the object in listings.
used for CSS styling"""
return "contenttype-" + queryUtility(IIDNormalizer).normalize(
- self.Type())
+ self.PortalType())
def ReviewStateClass(self):
"""A normalised review state string for CSS styling use in listings."""
@@ -89,3 +89,7 @@ def Type(self):
# Currently Type() returns different values depending on the data source being
# a brain or a real object. Probably needed. Support for all the attributes
# from the indexablemetadata wrappers.
+
+ def PortalType(self):
+ obj = self.getObject()
+ return obj.portal_type
@@ -130,7 +130,7 @@ def test_appendViewAction(self):
def test_item_ContentTypeClass(self):
# checking the that we print nice strings for css class identifiers
- self.assertEqual(self.item.ContentTypeClass(), 'contenttype-page')
+ self.assertEqual(self.item.ContentTypeClass(), 'contenttype-document')
def test_item_Language(self):
self.assertEqual(self.item.Language(), 'en')
@@ -211,7 +211,7 @@ def test_item_Type(self):
def test_item_ContentTypeClass(self):
# checking the that we print nice strings for css class identifiers
- self.assertEqual(self.item.ContentTypeClass(), 'contenttype-page')
+ self.assertEqual(self.item.ContentTypeClass(), 'contenttype-document')
def test_item_Language(self):
self.assertEqual(self.item.Language(), 'en')

0 comments on commit ff5a688

Please sign in to comment.