예제 #1
0
    def fetch(self):
        hebergements = []
        for heb in self():
            hebergements.append(heb)

        groupedDigits = calculateGroupedDigits(hebergements)

        groupedDigitsTmp = {}
        digit = 0
        mapObjects = []
        for heb in hebergements:
            groupedDigitTmp = None
            group_pk = heb.heb_groupement_pk
            # Allow to deactivate lines if only one heb in this group
            if group_pk in groupedDigits.keys() and groupedDigits[group_pk] != 0:
                if group_pk in groupedDigitsTmp.keys():
                    groupedDigitTmp = groupedDigitsTmp[group_pk] + 1
                else:
                    groupedDigitTmp = 0
                groupedDigitsTmp[group_pk] = groupedDigitTmp

            digit += 1
            mapObjects.append(
                hebergementToMapObject(
                    heb,
                    self.context,
                    self.request,
                    digit,
                    groupedDigitTmp))
        return mapObjects
예제 #2
0
 def fetch(self):
     heb = hebergementToMapObject(hebergement=self.context,
                                  context=self.context,
                                  request=self.request)
     return [heb]