~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/browser/root.py

  • Committer: Julian Edwards
  • Date: 2011-07-28 20:46:18 UTC
  • mfrom: (13553 devel)
  • mto: This revision was merged to the branch mainline in revision 13555.
  • Revision ID: julian.edwards@canonical.com-20110728204618-tivj2wx2oa9s32bx
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
"""Browser code for the Launchpad root page."""
4
4
 
13
13
import time
14
14
 
15
15
import feedparser
 
16
from lazr.batchnavigator import ListRangeFactory
16
17
from lazr.batchnavigator.z3batching import batch
17
 
from zope.app.form.interfaces import ConversionError
18
18
from zope.component import getUtility
19
19
from zope.interface import Interface
20
20
from zope.schema import TextLine
23
23
 
24
24
from canonical.config import config
25
25
from canonical.launchpad import _
26
 
from lp.services.statistics.interfaces.statistic import (
 
26
from canonical.launchpad.interfaces.launchpadstatistic import (
27
27
    ILaunchpadStatisticSet,
28
28
    )
29
29
from canonical.launchpad.webapp import LaunchpadView
61
61
class LaunchpadRootIndexView(HasAnnouncementsView, LaunchpadView):
62
62
    """An view for the default view of the LaunchpadRoot."""
63
63
 
64
 
    page_title = 'Launchpad'
65
64
    featured_projects = []
66
65
    featured_projects_top = None
67
66
 
406
405
        """See `LaunchpadFormView`"""
407
406
        errors = list(self.errors)
408
407
        for error in errors:
409
 
            if isinstance(error, ConversionError):
410
 
                self.setFieldError(
411
 
                    'text', 'Can not convert your search term.')
412
 
            elif isinstance(error, unicode):
413
 
                continue
414
 
            elif (error.field_name == 'text'
 
408
            if (error.field_name == 'text'
415
409
                and isinstance(error.errors, TooLong)):
416
410
                self.setFieldError(
417
411
                    'text', 'The search text cannot exceed 250 characters.')
597
591
        results = WindowedList(results, start, results.total)
598
592
        super(GoogleBatchNavigator, self).__init__(results, request,
599
593
            start=start, size=size, callback=callback,
600
 
            transient_parameters=transient_parameters,
601
 
            force_start=force_start, range_factory=range_factory)
 
594
            transient_parameters=transient_parameters, force_start=force_start,
 
595
            range_factory=range_factory)
602
596
 
603
597
    def determineSize(self, size, batch_params_source):
604
598
        # Force the default and users requested sizes to 20.