Title: [commits] (john) [11210] Remove displayName from Amazon parcel
Revision
11210
Author
john
Date
2006-07-19 17:39:55 -0700 (Wed, 19 Jul 2006)

Log Message

Remove displayName from Amazon parcel

Modified Paths

Diff

Modified: trunk/chandler/application/Utility.py (11209 => 11210)

--- trunk/chandler/application/Utility.py	2006-07-20 00:32:12 UTC (rev 11209)
+++ trunk/chandler/application/Utility.py	2006-07-20 00:39:55 UTC (rev 11210)
@@ -33,7 +33,7 @@
 # with your name (and some helpful text). The comment's really there just to
 # cause Subversion to warn you of a conflict when you update, in case someone 
 # else changes it at the same time you do (that's why it's on the same line).
-SCHEMA_VERSION = "219" #john: remove use of displayName from kindInfo
+SCHEMA_VERSION = "220" #john: remove displayName from Amazon parcel
 
 logger = None # initialized in initLogging()
 

Modified: trunk/chandler/parcels/amazon/AmazonBlocks.py (11209 => 11210)

--- trunk/chandler/parcels/amazon/AmazonBlocks.py	2006-07-20 00:32:12 UTC (rev 11209)
+++ trunk/chandler/parcels/amazon/AmazonBlocks.py	2006-07-20 00:39:55 UTC (rev 11210)
@@ -15,8 +15,9 @@
 
 __parcel__ = "amazon"
 
+from application import schema
+import AmazonKinds
 import osaf.framework.blocks.Block as Block
-import AmazonKinds
 import osaf.framework.blocks.detail.Detail as Detail
 
 #XXX[i18n] this module sits outsite of OSAF and should have its own translation domain
@@ -98,7 +99,8 @@
         if val == '':
             return ''
 
-        displayName = item.itsKind.getAttribute(field).displayName
+        displayNamesItem = schema.ns(__name__, self.itsView).displayNames
+        displayName = displayNamesItem.namesDictionary [field]
 
         return u"<tr><td align='right' valign='top' width='40%'>" + self._applyFont("<b>" + displayName + ":</b>") + \
                "</td><td align='left' valign='top'>" + self._applyFont(val) + "</td></tr>"
@@ -107,7 +109,9 @@
         if item.AverageCustomerRating == '':
             return ''
 
-        displayName = item.itsKind.getAttribute("AverageCustomerRating").displayName
+        displayNamesItem = schema.ns(__name__, self.itsView).displayNames
+        displayName = displayNamesItem.namesDictionary ["AverageCustomerRating"]
+
         txt = u"<tr><td align='right' valign='top' width='40%'>" + self._applyFont("<b>" + displayName + ":</b>") + "</td>"
 
         txt += "<td align='left' valign='top'><img src=''>"

Modified: trunk/chandler/parcels/amazon/AmazonKinds.py (11209 => 11210)

--- trunk/chandler/parcels/amazon/AmazonKinds.py	2006-07-20 00:32:12 UTC (rev 11209)
+++ trunk/chandler/parcels/amazon/AmazonKinds.py	2006-07-20 00:39:55 UTC (rev 11210)
@@ -280,19 +280,22 @@
         AmazonCollection, displayName = u'Amazon Collection',
     )
 
-    ProductName = schema.One(schema.Text, displayName = _(u'Product Name'))
-    ProductDescription = schema.One(schema.Text, displayName = _(u'Product Description'))
-    Author = schema.One(schema.Text, displayName = _(u'Author(s)'))
-    Media = schema.One(schema.Text, displayName = _(u'Media'))
-    ReleaseDate = schema.One(schema.Text, displayName = _(u'Release Date'))
-    ImageURL = schema.One(schema.URL, displayName = u'image path')
-    ProductURL = schema.One(schema.URL, displayName = u'product url')
-    NewPrice = schema.One(schema.Text, displayName = _(u'New Price'))
-    UsedPrice = schema.One(schema.Text, displayName = _(u'Used Price'))
-    Availability = schema.One(schema.Text, displayName = _(u'Availability'))
-    Manufacturer = schema.One(schema.Text, displayName = _(u'Manufacturer'))
-    AverageCustomerRating = schema.One(schema.Text, displayName = _(u'Average Customer Review'))
-    NumberOfReviews = schema.One(schema.Text, displayName = u'Number of people who reviewed the item')
+    # When you add/remove/modify attributes here remember to update the
+    # corresponding names displayed in the user interface in __init__.py
+    ProductName = schema.One(schema.Text)
+    ProductDescription = schema.One(schema.Text)
+    Author = schema.One(schema.Text)
+    Media = schema.One(schema.Text)
+    ReleaseDate = schema.One(schema.Text)
+    ImageURL = schema.One(schema.URL)
+    ProductURL = schema.One(schema.URL)
+    NewPrice = schema.One(schema.Text)
+    UsedPrice = schema.One(schema.Text)
+    Availability = schema.One(schema.Text)
+    Manufacturer = schema.One(schema.Text)
+    AverageCustomerRating = schema.One(schema.Text)
+    NumberOfReviews = schema.One(schema.Text)
+    
     about = schema.One(redirectTo = 'ProductName')
     who = schema.One(redirectTo = 'Author')
     date = schema.One(redirectTo = 'ReleaseDate')
@@ -358,7 +361,10 @@
 
             self.displayName = self.ProductName
 
+class DisplayNamesItem(schema.Item):
+    namesDictionary = schema.Mapping(schema.Text, defaultValue={})
 
+
 def _printBag(aBag, level):
     """
     This is used for debugging the incoming Amazon XML which is

Modified: trunk/chandler/parcels/amazon/__init__.py (11209 => 11210)

--- trunk/chandler/parcels/amazon/__init__.py	2006-07-20 00:32:12 UTC (rev 11209)
+++ trunk/chandler/parcels/amazon/__init__.py	2006-07-20 00:39:55 UTC (rev 11210)
@@ -13,7 +13,7 @@
 #   limitations under the License.
 
 
-from AmazonKinds import AmazonCollection, AmazonItem
+from AmazonKinds import AmazonCollection, AmazonItem, DisplayNamesItem
 from AmazonBlocks import AmazonController, AmazonDetailBlock
 
 from application import schema
@@ -68,3 +68,19 @@
             minimumSize = SizeType(100,50),
         ),
     ])
+
+    DisplayNamesItem.update(parcel, "displayNames",
+        namesDictionary = {'ProductName': _(u'Product Name'),
+                           'ProductDescription': _(u'Product Description'),
+                           'Author': _(u'Author(s)'),
+                           'Media': _(u'Media'),
+                           'ReleaseDate': _(u'Release Date'),
+                           'ImageURL': _(u'image path'),
+                           'ProductURL': _(u'product url'),
+                           'NewPrice': _(u'New Price'),
+                           'UsedPrice': _(u'Used Price'),
+                           'Availability': _(u'Availability'),
+                           'Manufacturer': _(u'Manufacturer'),
+                           'AverageCustomerRating': _(u'Average Customer Review'),
+                           'NumberOfReviews': _(u'Number of people who reviewed the item')})
+




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to