1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Navigation views for processors."""
__metaclass__ = type
__all__ = [
'ProcessorFamilySetNavigation',
'ProcessorSetNavigation',
]
from lp.app.errors import NotFoundError
from lp.services.webapp import Navigation
from lp.soyuz.interfaces.processor import (
IProcessorFamilySet,
IProcessorSet,
)
class ProcessorFamilySetNavigation(Navigation):
"""IProcessorFamilySet navigation."""
usedfor = IProcessorFamilySet
def traverse(self, name):
family = self.context.getByName(name)
# Raise NotFoundError on invalid processor family name.
if family is None:
raise NotFoundError(name)
return family
class ProcessorSetNavigation(Navigation):
"""IProcessorFamilySet navigation."""
usedfor = IProcessorSet
def traverse(self, name):
return self.context.getByName(name)
|