• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / grokcore.viewlet / 5776423262

pending completion
5776423262

push

github

web-flow
Config with pure python template (#7)

* Drop support for Python 2.7, 3.5, 3.6.

46 of 54 branches covered (85.19%)

Branch coverage included in aggregate %.

81 of 81 new or added lines in 21 files covered. (100.0%)

580 of 604 relevant lines covered (96.03%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.91
/src/grokcore/viewlet/tests/functional/viewlet/view_directive.py
1
"""
2
We check here that specifying grok.view() on module level works.
3
grok.view() on module level will make the viewlet manager be
4
associated with the CaveView, so nothing is found for BoneView
5
and an error should occur.
6

7
Set up a content object in the application root::
8

9
  >>> root = getRootFolder()
10
  >>> root['fred'] = Fred()
11

12
Traverse to the view on the model object. We get the viewlets
13
registered for the default layer, with the anybody permission::
14

15
  >>> from zope.testbrowser.wsgi import Browser
16
  >>> browser = Browser()
17
  >>> browser.handleErrors = False
18
  >>> browser.open("http://localhost/fred/@@boneview")
19
  Traceback (most recent call last):
20
  ...
21
  zope.contentprovider.interfaces.ContentProviderLookupError: cave
22

23
"""
24

25
import grokcore.viewlet as grok
1✔
26

27

28
class Fred(grok.Context):
1✔
29
    pass
1✔
30

31

32
class CaveView(grok.View):
1✔
33
    def render(self):
1✔
34
        return "Cave"
×
35

36

37
class BoneView(grok.View):
1✔
38
    pass
1✔
39

40

41
grok.view(CaveView)
1✔
42

43

44
class CaveManager(grok.ViewletManager):
1✔
45
    grok.name('cave')
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc