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
68dbb557
Commit
68dbb557
authored
Nov 21, 2000
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added __render_with_namespace__ protocol. Cleaned up logic of MM_cget.
parent
770255cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
62 deletions
+47
-62
lib/python/DocumentTemplate/cDocumentTemplate.c
lib/python/DocumentTemplate/cDocumentTemplate.c
+47
-62
No files found.
lib/python/DocumentTemplate/cDocumentTemplate.c
View file @
68dbb557
...
...
@@ -84,7 +84,7 @@
****************************************************************************/
static
char
cDocumentTemplate_module_documentation
[]
=
""
"
\n
$Id: cDocumentTemplate.c,v 1.3
4 2000/11/13 16:46:05 bri
an Exp $"
"
\n
$Id: cDocumentTemplate.c,v 1.3
5 2000/11/21 22:08:50 ev
an Exp $"
;
#include "ExtensionClass.h"
...
...
@@ -93,7 +93,7 @@ static PyObject *py_isDocTemp=0, *py_blocks=0, *py_=0, *join=0, *py_acquire;
static
PyObject
*
py___call__
,
*
py___roles__
,
*
py_AUTHENTICATED_USER
;
static
PyObject
*
py_hasRole
,
*
py__proxy_roles
,
*
py_Unauthorized
;
static
PyObject
*
py_Unauthorized_fmt
,
*
py_validate
;
static
PyObject
*
py__push
,
*
py__pop
,
*
py_aq_base
;
static
PyObject
*
py__push
,
*
py__pop
,
*
py_aq_base
,
*
py_renderNS
;
/* ----------------------------------------------------- */
...
...
@@ -402,7 +402,6 @@ static PyObject *
MM_cget
(
MM
*
self
,
PyObject
*
key
,
int
call
)
{
long
i
;
int
dt
=
0
;
PyObject
*
e
,
*
t
,
*
rr
,
*
tb
;
UNLESS
(
-
1
!=
(
i
=
PyList_Size
(
self
->
data
)))
return
NULL
;
...
...
@@ -411,71 +410,56 @@ MM_cget(MM *self, PyObject *key, int call)
e
=
PyList_GetItem
(
self
->
data
,
i
);
if
(
e
=
PyObject_GetItem
(
e
,
key
))
{
dt
=
0
;
/* if (PyCallable_Check(e)) */
if
(
!
call
)
return
e
;
/* Try calling __render_with_namespace__ */
if
(
rr
=
PyObject_GetAttr
(
e
,
py_renderNS
))
{
Py_DECREF
(
e
);
UNLESS_ASSIGN
(
rr
,
PyObject_CallFunction
(
rr
,
"O"
,
self
))
return
NULL
;
return
rr
;
}
else
PyErr_Clear
();
if
(
dtObjectIsCallable
(
e
))
{
/* Decide whether we have a document template
if (rr=PyObject_GetAttr(e,py_isDocTemp))
{
if (PyObject_IsTrue(rr)) dt=1;
Py_DECREF(rr);
}
else PyErr_Clear();
*/
dt
=
dtObjectIsDocTemp
(
e
);
/* Try calling the object */
if
(
call
)
{
if
(
dt
)
{
ASSIGN
(
e
,
PyObject_CallFunction
(
e
,
"OO"
,
Py_None
,
self
));
UNLESS
(
e
)
return
NULL
;
}
else
{
rr
=
PyObject_CallObject
(
e
,
NULL
);
if
(
rr
)
ASSIGN
(
e
,
rr
);
else
{
PyErr_Fetch
(
&
t
,
&
rr
,
&
tb
);
if
(
t
!=
PyExc_AttributeError
||
PyObject_Compare
(
rr
,
py___call__
)
!=
0
)
{
PyErr_Restore
(
t
,
rr
,
tb
);
Py_DECREF
(
e
);
return
NULL
;
}
/*
Added by Brian on 08/30/99. We need to be sure
to DECREF the exception in the event of an
AttributeError to avoid leaking.
*/
else
{
Py_XDECREF
(
t
);
Py_XDECREF
(
rr
);
Py_XDECREF
(
tb
);
}
}
}
}
}
if
(
dtObjectIsDocTemp
(
e
))
{
ASSIGN
(
e
,
PyObject_CallFunction
(
e
,
"OO"
,
Py_None
,
self
));
UNLESS
(
e
)
return
NULL
;
return
e
;
}
rr
=
PyObject_CallObject
(
e
,
NULL
);
if
(
rr
)
ASSIGN
(
e
,
rr
);
else
{
PyErr_Fetch
(
&
t
,
&
rr
,
&
tb
);
if
(
t
!=
PyExc_AttributeError
||
PyObject_Compare
(
rr
,
py___call__
)
!=
0
)
{
PyErr_Restore
(
t
,
rr
,
tb
);
Py_DECREF
(
e
);
return
NULL
;
}
/*
Added by Brian on 08/30/99. We need to be sure
to DECREF the exception in the event of an
AttributeError to avoid leaking.
*/
else
{
Py_XDECREF
(
t
);
Py_XDECREF
(
rr
);
Py_XDECREF
(
tb
);
}
}
}
return
e
;
}
PyErr_Fetch
(
&
e
,
&
rr
,
&
tb
);
if
(
dt
||
e
!=
PyExc_KeyError
)
if
(
e
!=
PyExc_KeyError
)
{
PyErr_Restore
(
e
,
rr
,
tb
);
return
NULL
;
...
...
@@ -931,11 +915,12 @@ void
initcDocumentTemplate
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.3
4
$"
;
char
*
rev
=
"$Revision: 1.3
5
$"
;
DictInstanceType
.
ob_type
=&
PyType_Type
;
UNLESS
(
py_isDocTemp
=
PyString_FromString
(
"isDocTemp"
))
return
;
UNLESS
(
py_renderNS
=
PyString_FromString
(
"__render_with_namespace__"
))
return
;
UNLESS
(
py_blocks
=
PyString_FromString
(
"blocks"
))
return
;
UNLESS
(
py_acquire
=
PyString_FromString
(
"aq_acquire"
))
return
;
UNLESS
(
py___call__
=
PyString_FromString
(
"__call__"
))
return
;
...
...
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