Пример #1
0
 def history_info(self):
     context = aq_inner(self.context)
     recent = self.recent_items()
     if len(recent) > 0:
         obj = recent[0].getObject()
         if (IItemRepository.providedBy(context) or
                 IOrderableItem.providedBy(context) or
                 IOrderableItem.providedBy(obj)):
             history = {'time': obj.modified}
         else:
             chv = ContentHistoryView(obj, obj.REQUEST)
             history_list = chv.fullHistory()
             history = history_list[0]
         return history
Пример #2
0
 def applyChanges(self, data):
     context = aq_inner(self.context)
     assert IOrderableItem.providedBy(context)
     code = safe_unicode(data['productCode'])
     title = safe_unicode((data['title_de']))
     new_title = code + ' - ' + title
     data['title'] = new_title
     fti = getUtility(IDexterityFTI,
                      name='chromsystems.shopcontent.orderableitem')
     schema = fti.lookupSchema()
     fields = getFieldsInOrder(schema)
     for key, value in fields:
         try:
             new_value = data[key]
             setattr(context, key, new_value)
         except KeyError:
             continue
     modified(context)
     context.reindexObject(idxs='modified')
     IStatusMessage(self.request).addStatusMessage(
         _(u"The orderable item has successfully been updated"),
         type='info')
     return self.request.response.redirect(context.absolute_url() + '/view')