def get_number_of_partitions_for(self, ar):
        """Return the number of selected partitions
        """
        # fetch the number of partitions from the request
        uid = api.get_uid(ar)
        num = self.request.get("primary", {}).get(uid)

        if num is None:
            # get the number of partitions from the template
            template = ar.getTemplate()
            if template:
                num = len(template.getPartitions())
            else:
                num = DEFAULT_NUMBER_OF_PARTITIONS
        try:
            num = int(num)
        except (TypeError, ValueError):
            num = DEFAULT_NUMBER_OF_PARTITIONS
        return num
def get_number_of_partitions_for ( self , ar ) : uid = api . get_uid ( ar ) num = self . request . get ( "primary" , { } ) . get ( uid ) if num is None : template = ar . getTemplate ( ) if template : num = len ( template . getPartitions ( ) ) else : num = DEFAULT_NUMBER_OF_PARTITIONS try : num = int ( num ) except ( TypeError , ValueError ) : num = DEFAULT_NUMBER_OF_PARTITIONS return num
Return the number of selected partitions