Beispiel #1
0
 def __cleanData(self):
     """ Private method which cleans the list passed by the javascript in WConfModifPosterDesign.tpl,
     so that it can be properly used later.
     The following actions are taken:
        -When an item is erased while creating or editing a template, the item object is substitued
        by a "False" value. We have to remove these "False" values from the list.
        -When an item is moved, the coordinates of the item are stored for example like this: 'x':'124px', 'y':'45px'.
        We have to remove that 'px' at the end.
     """
     self.__templateData[4] = filter ( lambda item: item != False, self.__templateData[4]) # to remove items that have been deleted
     from MaKaC.services.interface.rpc.json import unicodeToUtf8
     unicodeToUtf8(self.__templateData)
     for item in self.__templateData[4]:
         if isinstance(item['x'],basestring) and item['x'][-2:] == 'px':
             item['x'] = item['x'][0:-2]
         if isinstance(item['y'],basestring) and item['y'][-2:] == 'px':
             item['y'] = item['y'][0:-2]
Beispiel #2
0
 def __cleanData(self):
     """ Private method which cleans the list passed by the javascript in WConfModifPosterDesign.tpl,
     so that it can be properly used later.
     The following actions are taken:
        -When an item is erased while creating or editing a template, the item object is substitued
        by a "False" value. We have to remove these "False" values from the list.
        -When an item is moved, the coordinates of the item are stored for example like this: 'x':'124px', 'y':'45px'.
        We have to remove that 'px' at the end.
     """
     self.__templateData[4] = filter(
         lambda item: item != False,
         self.__templateData[4])  # to remove items that have been deleted
     from MaKaC.services.interface.rpc.json import unicodeToUtf8
     unicodeToUtf8(self.__templateData)
     for item in self.__templateData[4]:
         if isinstance(item['x'], basestring) and item['x'][-2:] == 'px':
             item['x'] = item['x'][0:-2]
         if isinstance(item['y'], basestring) and item['y'][-2:] == 'px':
             item['y'] = item['y'][0:-2]