Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
c7666096
Commit
c7666096
authored
Mar 21, 2005
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The blob work requires zope.proxy.
parent
eba4461d
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1822 additions
and
0 deletions
+1822
-0
trunk/src/zope/proxy/DEPENDENCIES.cfg
trunk/src/zope/proxy/DEPENDENCIES.cfg
+2
-0
trunk/src/zope/proxy/SETUP.cfg
trunk/src/zope/proxy/SETUP.cfg
+8
-0
trunk/src/zope/proxy/__init__.py
trunk/src/zope/proxy/__init__.py
+31
-0
trunk/src/zope/proxy/_zope_proxy_proxy.c
trunk/src/zope/proxy/_zope_proxy_proxy.c
+1098
-0
trunk/src/zope/proxy/interfaces.py
trunk/src/zope/proxy/interfaces.py
+62
-0
trunk/src/zope/proxy/proxy.h
trunk/src/zope/proxy/proxy.h
+54
-0
trunk/src/zope/proxy/tests/__init__.py
trunk/src/zope/proxy/tests/__init__.py
+2
-0
trunk/src/zope/proxy/tests/test_proxy.py
trunk/src/zope/proxy/tests/test_proxy.py
+565
-0
No files found.
trunk/src/zope/proxy/DEPENDENCIES.cfg
0 → 100644
View file @
c7666096
zope.interface
zope.testing
trunk/src/zope/proxy/SETUP.cfg
0 → 100644
View file @
c7666096
# Packaging information for zpkg.
header proxy.h
<extension _zope_proxy_proxy>
source _zope_proxy_proxy.c
depends-on proxy.h
</extension>
trunk/src/zope/proxy/__init__.py
0 → 100644
View file @
c7666096
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""More convenience functions for dealing with proxies.
$Id$
"""
from
zope.interface
import
moduleProvides
from
zope.proxy.interfaces
import
IProxyIntrospection
from
types
import
ClassType
from
zope.proxy._zope_proxy_proxy
import
*
from
zope.proxy._zope_proxy_proxy
import
_CAPI
moduleProvides
(
IProxyIntrospection
)
__all__
=
tuple
(
IProxyIntrospection
)
def
ProxyIterator
(
p
):
yield
p
while
isProxy
(
p
):
p
=
getProxiedObject
(
p
)
yield
p
trunk/src/zope/proxy/_zope_proxy_proxy.c
0 → 100644
View file @
c7666096
This diff is collapsed.
Click to expand it.
trunk/src/zope/proxy/interfaces.py
0 → 100644
View file @
c7666096
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Proxy-related interfaces.
$Id$
"""
from
zope.interface
import
Interface
class
IProxyIntrospection
(
Interface
):
"""Provides methods for indentifying proxies and extracting proxied objects
"""
def
isProxy
(
obj
,
proxytype
=
None
):
"""Check whether the given object is a proxy
If proxytype is not None, checkes whether the object is
proxied by the given proxytype.
"""
def
sameProxiedObjects
(
ob1
,
ob2
):
"""Check whether ob1 and ob2 are the same or proxies of the same object
"""
def
getProxiedObject
(
obj
):
"""Get the proxied Object
If the object isn't proxied, then just return the object.
"""
def
removeAllProxies
(
obj
):
"""Get the proxied object with no proxies
If obj is not a proxied object, return obj.
The returned object has no proxies.
"""
def
queryProxy
(
obj
,
proxytype
,
default
=
None
):
"""Look for a proxy of the given type around the object
If no such proxy can be found, return the default.
"""
def
queryInnerProxy
(
obj
,
proxytype
,
default
=
None
):
"""Look for the inner-most proxy of the given type around the object
If no such proxy can be found, return the default.
If there is such a proxy, return the inner-most one.
"""
trunk/src/zope/proxy/proxy.h
0 → 100644
View file @
c7666096
#ifndef _proxy_H_
#define _proxy_H_ 1
typedef
struct
{
PyObject_HEAD
PyObject
*
proxy_object
;
}
ProxyObject
;
#define Proxy_GET_OBJECT(ob) (((ProxyObject *)(ob))->proxy_object)
typedef
struct
{
PyTypeObject
*
proxytype
;
int
(
*
check
)(
PyObject
*
obj
);
PyObject
*
(
*
create
)(
PyObject
*
obj
);
PyObject
*
(
*
getobject
)(
PyObject
*
proxy
);
}
ProxyInterface
;
#ifndef PROXY_MODULE
/* These are only defined in the public interface, and are not
* available within the module implementation. There we use the
* classic Python/C API only.
*/
static
ProxyInterface
*
_proxy_api
=
NULL
;
static
int
Proxy_Import
(
void
)
{
if
(
_proxy_api
==
NULL
)
{
PyObject
*
m
=
PyImport_ImportModule
(
"zope.proxy"
);
if
(
m
!=
NULL
)
{
PyObject
*
tmp
=
PyObject_GetAttrString
(
m
,
"_CAPI"
);
if
(
tmp
!=
NULL
)
{
if
(
PyCObject_Check
(
tmp
))
_proxy_api
=
(
ProxyInterface
*
)
PyCObject_AsVoidPtr
(
tmp
);
Py_DECREF
(
tmp
);
}
}
}
return
(
_proxy_api
==
NULL
)
?
-
1
:
0
;
}
#define ProxyType (*_proxy_api->proxytype)
#define Proxy_Check(obj) (_proxy_api->check((obj)))
#define Proxy_CheckExact(obj) ((obj)->ob_type == ProxyType)
#define Proxy_New(obj) (_proxy_api->create((obj)))
#define Proxy_GetObject(proxy) (_proxy_api->getobject((proxy)))
#endif
/* PROXY_MODULE */
#endif
/* _proxy_H_ */
trunk/src/zope/proxy/tests/__init__.py
0 → 100644
View file @
c7666096
#
# This file is necessary to make this directory a package.
trunk/src/zope/proxy/tests/test_proxy.py
0 → 100644
View file @
c7666096
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