Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Zope
Commits
93918ccf
Commit
93918ccf
authored
Jan 04, 2000
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed a bug that provided access to fnction attributes.
parent
767055a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
lib/python/DocumentTemplate/cDocumentTemplate.c
lib/python/DocumentTemplate/cDocumentTemplate.c
+24
-3
No files found.
lib/python/DocumentTemplate/cDocumentTemplate.c
View file @
93918ccf
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
****************************************************************************/
****************************************************************************/
static
char
cDocumentTemplate_module_documentation
[]
=
static
char
cDocumentTemplate_module_documentation
[]
=
""
""
"
\n
$Id: cDocumentTemplate.c,v 1.
29 1999/08/30 17:54:01 brian
Exp $"
"
\n
$Id: cDocumentTemplate.c,v 1.
30 2000/01/04 15:59:18 jim
Exp $"
;
;
#include "ExtensionClass.h"
#include "ExtensionClass.h"
...
@@ -876,7 +876,7 @@ static PyObject *
...
@@ -876,7 +876,7 @@ static PyObject *
validate
(
PyObject
*
self
,
PyObject
*
args
)
validate
(
PyObject
*
self
,
PyObject
*
args
)
{
{
PyObject
*
inst
,
*
parent
,
*
name
,
*
value
,
*
md
,
*
__roles__
,
*
i
,
*
p
;
PyObject
*
inst
,
*
parent
,
*
name
,
*
value
,
*
md
,
*
__roles__
,
*
i
,
*
p
;
char
*
cname
;
char
*
cname
=
0
;
long
ir
;
long
ir
;
/* def validate(self, inst, parent, name, value, md): */
/* def validate(self, inst, parent, name, value, md): */
...
@@ -896,6 +896,15 @@ validate(PyObject *self, PyObject *args)
...
@@ -896,6 +896,15 @@ validate(PyObject *self, PyObject *args)
/*
/*
if hasattr(value, '__roles__'): roles=value.__roles__
if hasattr(value, '__roles__'): roles=value.__roles__
else:
else:
if (name[:5]=='func_' and
type(parent) in (
types.MethodType, types.FunctionType,
type(DTMLMethod.validate) )
):
# we don't want any function attributes
return 0
if hasattr(parent,'__roles__'): roles=parent.__roles__
if hasattr(parent,'__roles__'): roles=parent.__roles__
elif hasattr(parent, 'aq_acquire'):
elif hasattr(parent, 'aq_acquire'):
try: roles=parent.aq_acquire('__roles__')
try: roles=parent.aq_acquire('__roles__')
...
@@ -912,6 +921,18 @@ validate(PyObject *self, PyObject *args)
...
@@ -912,6 +921,18 @@ validate(PyObject *self, PyObject *args)
UNLESS
(
__roles__
=
PyObject_GetAttr
(
value
,
py___roles__
))
UNLESS
(
__roles__
=
PyObject_GetAttr
(
value
,
py___roles__
))
{
{
PyErr_Clear
();
PyErr_Clear
();
if
(
(
*
cname
==
'f'
&&
cname
[
1
]
==
'u'
&&
cname
[
2
]
==
'n'
&&
cname
[
3
]
==
'c'
&&
cname
[
4
]
==
'_'
)
&&
(
PyECMethod_Check
(
parent
)
||
PyFunction_Check
(
parent
)
||
PyMethod_Check
(
parent
)
)
)
return
PyInt_FromLong
(
0
);
UNLESS
(
__roles__
=
PyObject_GetAttr
(
parent
,
py___roles__
))
UNLESS
(
__roles__
=
PyObject_GetAttr
(
parent
,
py___roles__
))
{
{
PyErr_Clear
();
PyErr_Clear
();
...
@@ -1042,7 +1063,7 @@ void
...
@@ -1042,7 +1063,7 @@ void
initcDocumentTemplate
()
initcDocumentTemplate
()
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
29
$"
;
char
*
rev
=
"$Revision: 1.
30
$"
;
PURE_MIXIN_CLASS
(
cDocument
,
PURE_MIXIN_CLASS
(
cDocument
,
"Base class for documents that adds fast validation method"
,
"Base class for documents that adds fast validation method"
,
Document_methods
);
Document_methods
);
...
...
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