Merge lp:~stevenk/launchpad/less-lazr-security into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 12437
Proposed branch: lp:~stevenk/launchpad/less-lazr-security
Merge into: lp:launchpad
Diff against target: 118 lines (+1/-92)
4 files modified
lib/canonical/lazr/debug.py (+0/-9)
lib/canonical/lazr/doc/checker-utilities.txt (+0/-73)
lib/canonical/lazr/security.py (+0/-9)
versions.cfg (+1/-1)
To merge this branch: bzr merge lp:~stevenk/launchpad/less-lazr-security
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
William Grant code* Approve
Review via email: mp+50824@code.launchpad.net

Commit message

[r=lifeless,wgrant][no-qa] Remove a doctest and some glue from lib/canonical/lazr.

Description of the change

Delete as much of lib/canonical/lazr as I could. The doctest is now in lazr.restful 0.17.1, and so the helper methods can die too.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code*)
Revision history for this message
Robert Collins (lifeless) :
review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

Be ware that shipit may choose to hate on you. We'll see.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'lib/canonical/lazr/debug.py'
--- lib/canonical/lazr/debug.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/lazr/debug.py 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).
3
4# Re-import code from lazr.restful until it can be refactored into a
5# utility module.
6__all__ = []
7import lazr.restful.debug
8__all__.extend(lazr.restful.debug.__all__)
9from lazr.restful.debug import *
100
=== removed file 'lib/canonical/lazr/doc/checker-utilities.txt'
--- lib/canonical/lazr/doc/checker-utilities.txt 2009-04-17 10:32:16 +0000
+++ lib/canonical/lazr/doc/checker-utilities.txt 1970-01-01 00:00:00 +0000
@@ -1,73 +0,0 @@
1= Utilities to define security checkers =
2
3LAZR provides utility functions to make it easy to define security
4checkers for content class.
5
6[XXX leonardr 2009-04-02 bug=354441
7 This test should be moved into the same lazr module as the code it
8 tests, security.py (in lazr.restful as of this writing.)]
9
10
11== protect_schema() ==
12
13The protect_schema() function will define a checker for a class based on
14the schema passed in as parameter.
15
16 >>> from canonical.lazr.security import protect_schema
17 >>> from zope.interface import Attribute, Interface, implements
18 >>> from zope.schema import TextLine
19
20 >>> class MySchema(Interface):
21 ... an_attr = Attribute(u'An attribute.')
22 ...
23 ... a_field = TextLine(title=u'A property that can be set.')
24 ...
25 ... a_read_only_field = TextLine(
26 ... title=u'A read only property', readonly=True)
27 ...
28 ... def aMethod():
29 ... "A simple method."
30
31 >>> class MyContent(object):
32 ... implements(MySchema)
33 ... def __init__(self, an_attr, a_field, a_read_only_field):
34 ... self.an_attr = an_attr
35 ... self.a_field = a_field
36 ... self.a_read_only_field = a_read_only_field
37 ...
38 ... def aMethod(self):
39 ... pass
40 ...
41 >>> protect_schema(MyContent, MySchema)
42
43By default, the defined checker will grant public access to all
44attributes defined in the schema.
45
46 >>> from canonical.lazr.debug import debug_proxy
47 >>> from zope.security.checker import undefineChecker, ProxyFactory
48 >>> content = MyContent(1, u'Mutable Field', u'RO Field')
49
50 # ProxyFactory wraps the content using the defined checker.
51 >>> print debug_proxy(ProxyFactory(content))
52 zope.security._proxy._Proxy (using zope.security.checker.Checker)
53 public: aMethod, a_field, a_read_only_field, an_attr
54
55The permission required can be specified using the read_permission
56parameter:
57
58 >>> undefineChecker(MyContent)
59 >>> protect_schema(MyContent, MySchema, read_permission='lazr.View')
60 >>> print debug_proxy(ProxyFactory(content))
61 zope.security._proxy._Proxy (using zope.security.checker.Checker)
62 lazr.View: aMethod, a_field, a_read_only_field, an_attr
63
64If you specify a write_permission parameter, set permission will be
65granted for Attribute and non-readonly fields defined in the schema.
66
67 >>> undefineChecker(MyContent)
68 >>> protect_schema(MyContent, MySchema, write_permission='lazr.Edit')
69 >>> print debug_proxy(ProxyFactory(content))
70 zope.security._proxy._Proxy (using zope.security.checker.Checker)
71 lazr.Edit (set): a_field, an_attr
72 public: aMethod, a_field, a_read_only_field, an_attr
73
740
=== removed file 'lib/canonical/lazr/security.py'
--- lib/canonical/lazr/security.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/lazr/security.py 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).
3
4# Re-import code from lazr.restful until it can be refactored into a
5# utility module.
6__all__ = []
7import lazr.restful.security
8__all__.extend(lazr.restful.security.__all__)
9from lazr.restful.security import *
100
=== modified file 'versions.cfg'
--- versions.cfg 2011-02-17 01:41:03 +0000
+++ versions.cfg 2011-02-22 23:06:22 +0000
@@ -33,7 +33,7 @@
33lazr.delegates = 1.2.033lazr.delegates = 1.2.0
34lazr.enum = 1.1.234lazr.enum = 1.1.2
35lazr.lifecycle = 1.135lazr.lifecycle = 1.1
36lazr.restful = 0.16.136lazr.restful = 0.17.1
37lazr.restfulclient = 0.11.237lazr.restfulclient = 0.11.2
38lazr.smtptest = 1.138lazr.smtptest = 1.1
39lazr.testing = 0.1.139lazr.testing = 0.1.1