Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Acquisition
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Acquisition
Commits
8a77d12c
Commit
8a77d12c
authored
Mar 30, 2015
by
Tres Seaver
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pypy-py3k' of
git://github.com/NextThought/Acquisition
into NextThought-pypy-py3k
parents
2667b34d
ba35cf6f
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1435 additions
and
100 deletions
+1435
-100
.travis.yml
.travis.yml
+2
-0
CHANGES.rst
CHANGES.rst
+7
-2
README.rst
README.rst
+7
-7
setup.py
setup.py
+24
-8
src/Acquisition/__init__.py
src/Acquisition/__init__.py
+830
-3
src/Acquisition/tests.py
src/Acquisition/tests.py
+565
-80
No files found.
.travis.yml
View file @
8a77d12c
...
@@ -3,6 +3,8 @@ sudo: false
...
@@ -3,6 +3,8 @@ sudo: false
python
:
python
:
-
2.6
-
2.6
-
2.7
-
2.7
-
3.4
-
pypy
install
:
install
:
-
python bootstrap.py
-
python bootstrap.py
-
bin/buildout
-
bin/buildout
...
...
CHANGES.rst
View file @
8a77d12c
Changelog
Changelog
=========
=========
4.2 (unreleased)
----------------
- Add support for PyPy and Python 3.
4.1 (2014-12-18)
4.1 (2014-12-18)
----------------
----------------
...
...
README.rst
View file @
8a77d12c
...
@@ -34,7 +34,7 @@ class. For example::
...
@@ -34,7 +34,7 @@ class. For example::
>>> class A(Acquisition.Implicit):
>>> class A(Acquisition.Implicit):
... def report(self):
... def report(self):
... print
self.color
... print
(self.color)
...
...
>>> a = A()
>>> a = A()
>>> c = C()
>>> c = C()
...
@@ -107,7 +107,7 @@ When explicit acquisition is used, attributes are not automatically
...
@@ -107,7 +107,7 @@ When explicit acquisition is used, attributes are not automatically
obtained from the environment. Instead, the method aq_acquire must be
obtained from the environment. Instead, the method aq_acquire must be
used. For example::
used. For example::
>>> print
c.a.aq_acquire('color'
)
>>> print
(c.a.aq_acquire('color')
)
red
red
To support explicit acquisition, your class should inherit from the
To support explicit acquisition, your class should inherit from the
...
@@ -192,7 +192,7 @@ Here's an example::
...
@@ -192,7 +192,7 @@ Here's an example::
>>> def find_nice(self, ancestor, name, object, extra):
>>> def find_nice(self, ancestor, name, object, extra):
... return hasattr(object,'isNice') and object.isNice
... return hasattr(object,'isNice') and object.isNice
>>> print
a.b.c.aq_acquire('p', find_nice
)
>>> print
(a.b.c.aq_acquire('p', find_nice)
)
spam(Nice) and I am nice!
spam(Nice) and I am nice!
The filtered acquisition in the last line skips over the first
The filtered acquisition in the last line skips over the first
...
@@ -221,7 +221,7 @@ method. For example::
...
@@ -221,7 +221,7 @@ method. For example::
>>> a = C()
>>> a = C()
>>> b = C()
>>> b = C()
>>> a.color = "red"
>>> a.color = "red"
>>> print
b.__of__(a).color
>>> print
(b.__of__(a).color)
red
red
In this case, ``a`` does not contain ``b``, but it is put in ``b``'s
In this case, ``a`` does not contain ``b``, but it is put in ``b``'s
...
@@ -241,7 +241,7 @@ acquisition context that includes non-container objects::
...
@@ -241,7 +241,7 @@ acquisition context that includes non-container objects::
>>> a.b.color = "red"
>>> a.b.color = "red"
>>> a.x = C("x")
>>> a.x = C("x")
>>> print
a.b.x.color
>>> print
(a.b.x.color)
red
red
Even though ``b`` does not contain ``x``, ``x`` can acquire the color
Even though ``b`` does not contain ``x``, ``x`` can acquire the color
...
@@ -262,7 +262,7 @@ If in the example above suppose both a and b have an color attribute::
...
@@ -262,7 +262,7 @@ If in the example above suppose both a and b have an color attribute::
>>> a.b.color = "red"
>>> a.b.color = "red"
>>> a.x = C("x")
>>> a.x = C("x")
>>> print
a.b.x.color
>>> print
(a.b.x.color)
green
green
Why does ``a.b.x.color`` acquire color from ``a`` and not from ``b``?
Why does ``a.b.x.color`` acquire color from ``a`` and not from ``b``?
...
...
setup.py
View file @
8a77d12c
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
"""Setup for the Acquisition distribution
"""Setup for the Acquisition distribution
"""
"""
import
os
import
os
import
platform
import
sys
from
setuptools
import
setup
,
find_packages
,
Extension
from
setuptools
import
setup
,
find_packages
,
Extension
with
open
(
'README.rst'
)
as
f
:
with
open
(
'README.rst'
)
as
f
:
...
@@ -22,9 +24,24 @@ with open('README.rst') as f:
...
@@ -22,9 +24,24 @@ with open('README.rst') as f:
with
open
(
'CHANGES.rst'
)
as
f
:
with
open
(
'CHANGES.rst'
)
as
f
:
CHANGES
=
f
.
read
()
CHANGES
=
f
.
read
()
# PyPy won't build the extension.
py_impl
=
getattr
(
platform
,
'python_implementation'
,
lambda
:
None
)
is_pypy
=
py_impl
()
==
'PyPy'
is_pure
=
'PURE_PYTHON'
in
os
.
environ
py3k
=
sys
.
version_info
>=
(
3
,
)
if
is_pypy
or
is_pure
or
py3k
:
ext_modules
=
[]
else
:
ext_modules
=
[
Extension
(
"Acquisition._Acquisition"
,
[
os
.
path
.
join
(
'src'
,
'Acquisition'
,
'_Acquisition.c'
)],
include_dirs
=
[
'include'
,
'src'
]),
]
setup
(
setup
(
name
=
'Acquisition'
,
name
=
'Acquisition'
,
version
=
'4.
1
'
,
version
=
'4.
2.dev0
'
,
url
=
'https://github.com/zopefoundation/Acquisition'
,
url
=
'https://github.com/zopefoundation/Acquisition'
,
license
=
'ZPL 2.1'
,
license
=
'ZPL 2.1'
,
description
=
"Acquisition is a mechanism that allows objects to obtain "
description
=
"Acquisition is a mechanism that allows objects to obtain "
...
@@ -41,18 +58,17 @@ setup(
...
@@ -41,18 +58,17 @@ setup(
"License :: OSI Approved :: Zope Public License"
,
"License :: OSI Approved :: Zope Public License"
,
"Operating System :: OS Independent"
,
"Operating System :: OS Independent"
,
"Programming Language :: Python"
,
"Programming Language :: Python"
,
"Programming Language :: Python :: 2
:: Only
"
,
"Programming Language :: Python :: 2"
,
"Programming Language :: Python :: 2.6"
,
"Programming Language :: Python :: 2.6"
,
"Programming Language :: Python :: 2.7"
,
"Programming Language :: Python :: 2.7"
,
"Programming Language :: Python :: 3"
,
"Programming Language :: Python :: 3.4"
,
"Programming Language :: Python :: Implementation :: CPython"
,
"Programming Language :: Python :: Implementation :: CPython"
,
"Programming Language :: Python :: Implementation :: PyPy"
,
],
],
ext_modules
=
[
Extension
(
"Acquisition._Acquisition"
,
ext_modules
=
ext_modules
,
[
os
.
path
.
join
(
'src'
,
'Acquisition'
,
'_Acquisition.c'
)],
include_dirs
=
[
'include'
,
'src'
]),
],
install_requires
=
[
install_requires
=
[
'ExtensionClass >= 4.1
a
1'
,
'ExtensionClass >= 4.1
.
1'
,
'zope.interface'
,
'zope.interface'
,
],
],
include_package_data
=
True
,
include_package_data
=
True
,
...
...
src/Acquisition/__init__.py
View file @
8a77d12c
This diff is collapsed.
Click to expand it.
src/Acquisition/tests.py
View file @
8a77d12c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment