def __init__(self, context, request):
        GroupPage.__init__(self, context, request)

        try:
            self.start = int(self.request.form.get('start', 0))
        except ValueError:
            self.start = 0
        try:
            self.end = int(self.request.form.get('end', 20))
        except ValueError:
            self.end = 20

        # Swap the start and end, if necessary
        if self.start > self.end:
            tmp = self.end
            self.end = self.start
            self.start = tmp
        nTopics = (self.end - self.start)
        if (nTopics > self.topNTopics):
            m = 'Request for %d topics (%d--%d) from %s (%s) on ' \
                '%s (%s) is too high; returning %d.' % \
                (nTopics, self.start, self.end, self.groupInfo.name,
                 self.groupInfo.id, self.siteInfo.name,
                 self.siteInfo.id, self.topNTopics)
            log.warn(m)
            self.end = self.start + self.topNTopics

        # Ensure we do not walk off the end of the array.
        if self.start > self.numTopics:
            self.start = max((0, self.numTopics - self.topNTopics))
 def __init__(self, context, request):
     GroupPage.__init__(self, context, request)
Beispiel #3
0
 def __init__(self, context, request):
     GroupPage.__init__(self, context, request)
 def __init__(self, context, request):
     GroupPage.__init__(self, context, request)
     self.postId = self.request.get('postId', None)
     if not self.postId:
         raise NoIDError('No ID Specified')