Esempio n. 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
 def applyChanges(self, data):
     context = aq_inner(self.context)
     assert IItemRepository.providedBy(context)
     container = context
     code = safe_unicode(data['productCode'])
     title = safe_unicode((data['title_de']))
     new_title = code + ' - ' + title
     data['title'] = new_title
     item = createContentInContainer(
         container,
         'chromsystems.shopcontent.orderableitem',
         checkConstraints=True, **data)
     modified(item)
     item.reindexObject(idxs='modified')
     IStatusMessage(self.request).addStatusMessage(
         _(u"A new orderable item has successfully been added"),
         type='info')
     return self.request.response.redirect(context.absolute_url() + '/view')