Commit 20ff16f3 authored by Shane Hathaway's avatar Shane Hathaway

Merged changes from the cDocumentTemplateCleanup branch.

parent 7048a810
......@@ -4,134 +4,15 @@ Zope changes
Change information for previous versions of Zope can be found in the
file HISTORY.txt.
Zope 2.2.0 beta 1
Zope 2.2.0
Features Changed
- Split the old CHANGES.txt into two files. CHANGES.txt will
now contain only change information for the current Zope
release. Change information for older versions is now in
the file HISTORY.txt.
- Added basic internal support for mountable databases. A separate
product will still be required to make use of this ability.
- Added a new "history" tab to selected objects (DTML methods and
documents for now) that provides access to previous versions
through the web.
- The property management screens now include the types for
existing properties.
- Added support at Python level for user-defined
__get/set/delattr__ methods on persistent objects. These
have essentially the same semantics as for Python, except
that overridden __set/delattr__ methods must explicitly
signal changes that should be persistent.
- Better error messages and syslog capabilities were added to
pcgi-wrapper (thanks to Jeff Rush).
- Calls to the ZLogger system were added to the user authentication
process to help sys admins diagnose login problems (thanks again
to Jeff Rush).
- The Undo view shows *only* transactions performed in the
place where undo was performed. (As before, it also
shows only transactions performed by users defined in the
place where the undo user is defined.)
- The way that transaction logging is done was changed to make
transaction logs based on "physical" object and user
paths. This was necessary to make undo work properly in the
presense of virtual hosts.
- A number of hooks have been added and changes made to
support products that implement virtual hosts. Keep an eye on
http://www.zope.org/Members/michel/Projects/Interfaces/ImplementingVirtualHosts
- The distributions now have an Extensions directory by default.
Bugs Fixed
- Added type checking to the constructor and edit methods of
builtin Zope object types to prevent inappropriate passing
of acquisition-wrapped objects for standard attributes (like
title, etc.). A similar restriction was added to prevent the
adding of wrapped objects as properties.
- Fixed a naming bug in MailHost that caused simple_send to
fail.
- Fixed a buglet in the rename form that caused the form to submit
to the old manage_renameObject if the user just hit the enter
key in the browser on a single item rename.
- A bug that caused the tabs to disappear after performing cache
management operations was fixed.
- A problem that prevented multiple Zope instances from running
at the same time on win32 was fixed.
- An algorithm in medusa's max_sockets.py code was updated to
improve startup time on certain platforms.
- The behavior of manage_editProperties on PropertyManagers and
PropertySheets has been fixed so that existing properties that
are not found in the update request are not reset to empty
values.
- A problem that disallowed access to the individual records in
a result set from a SQL method was fixed.
- A problem that caused the query template for an SQL method to
be rendered twice when used from the "test" tab has been fixed.
- Fix for bug #1270: Netscape Image Problems. Added casts to long
to avoid an overflow error caused when trying to convert dates
sent by certain versions of Netscape in the If-Modified-Since
header.
- Corrected DateTime.py to recognize years specified as 00 through
69 as 2000 through 2069.
- A bug that made objects named in dtml namespaces always fail
security validation was fixed. This was noticed by folks trying
to use manage_tabs from ZClasses who hit the bug because the
manage_tags document uses a namespace:
<dtml-with "_(manage_options=...">
- A change to pcgi_publisher was made to support FreeBSD, where
send() will send only 8192 bytes at a time.
- A bug that broke import in the alpha was fixed.
- A bug in the transaction handling logic could cause infinite
loops if objects were registered incorrectly.
- A bug in the transaction machinery could cause objects to
be aborted multiple times if errors occurred.
- Logging via syslog now correctly captures the process id.
- Adding User Folders and MailHosts from the management screens
didn't redirect to the correct URL after adding the object.
- A form problem that prevented joining or leaving versions
has been fixed.
- A more reasonable default content type is now used for HEAD
requests on DTML objects if the object does not have a
content_type attribute or a file-extension-like id that can
be used to determine content type.
- HTTP HEAD handling was inconsistent for collections, depending
on whether the "default document" (index_html) was acquired or
not.
- Fixed ZService.py to avoid overwriting existing service start
parameters at install time on win32.
- The deprecated alias getSize() was added back to Image and DTML
objects (existing products still depend on it).
......@@ -4,6 +4,131 @@ Zope history
Zope. Change information for the current release can be found
in the file CHANGES.txt.
Zope 2.2.0 beta 1
Features Changed
- Split the old CHANGES.txt into two files. CHANGES.txt will
now contain only change information for the current Zope
release. Change information for older versions is now in
the file HISTORY.txt.
- Added basic internal support for mountable databases. A separate
product will still be required to make use of this ability.
- Added a new "history" tab to selected objects (DTML methods and
documents for now) that provides access to previous versions
through the web.
- The property management screens now include the types for
existing properties.
- Added support at Python level for user-defined
__get/set/delattr__ methods on persistent objects. These
have essentially the same semantics as for Python, except
that overridden __set/delattr__ methods must explicitly
signal changes that should be persistent.
- Better error messages and syslog capabilities were added to
pcgi-wrapper (thanks to Jeff Rush).
- Calls to the ZLogger system were added to the user authentication
process to help sys admins diagnose login problems (thanks again
to Jeff Rush).
- The Undo view shows *only* transactions performed in the
place where undo was performed. (As before, it also
shows only transactions performed by users defined in the
place where the undo user is defined.)
- The way that transaction logging is done was changed to make
transaction logs based on "physical" object and user
paths. This was necessary to make undo work properly in the
presense of virtual hosts.
- A number of hooks have been added and changes made to
support products that implement virtual hosts. Keep an eye on
http://www.zope.org/Members/michel/Projects/Interfaces/ImplementingVirtualHosts
- The distributions now have an Extensions directory by default.
Bugs Fixed
- Added type checking to the constructor and edit methods of
builtin Zope object types to prevent inappropriate passing
of acquisition-wrapped objects for standard attributes (like
title, etc.). A similar restriction was added to prevent the
adding of wrapped objects as properties.
- Fixed a naming bug in MailHost that caused simple_send to
fail.
- Fixed a buglet in the rename form that caused the form to submit
to the old manage_renameObject if the user just hit the enter
key in the browser on a single item rename.
- A bug that caused the tabs to disappear after performing cache
management operations was fixed.
- A problem that prevented multiple Zope instances from running
at the same time on win32 was fixed.
- An algorithm in medusa's max_sockets.py code was updated to
improve startup time on certain platforms.
- The behavior of manage_editProperties on PropertyManagers and
PropertySheets has been fixed so that existing properties that
are not found in the update request are not reset to empty
values.
- A problem that disallowed access to the individual records in
a result set from a SQL method was fixed.
- A problem that caused the query template for an SQL method to
be rendered twice when used from the "test" tab has been fixed.
- Fix for bug #1270: Netscape Image Problems. Added casts to long
to avoid an overflow error caused when trying to convert dates
sent by certain versions of Netscape in the If-Modified-Since
header.
- Corrected DateTime.py to recognize years specified as 00 through
69 as 2000 through 2069.
- A bug that made objects named in dtml namespaces always fail
security validation was fixed. This was noticed by folks trying
to use manage_tabs from ZClasses who hit the bug because the
manage_tags document uses a namespace:
<dtml-with "_(manage_options=...">
- A change to pcgi_publisher was made to support FreeBSD, where
send() will send only 8192 bytes at a time.
- A bug that broke import in the alpha was fixed.
- A bug in the transaction handling logic could cause infinite
loops if objects were registered incorrectly.
- A bug in the transaction machinery could cause objects to
be aborted multiple times if errors occurred.
- Logging via syslog now correctly captures the process id.
- Adding User Folders and MailHosts from the management screens
didn't redirect to the correct URL after adding the object.
- A form problem that prevented joining or leaving versions
has been fixed.
- A more reasonable default content type is now used for HEAD
requests on DTML objects if the object does not have a
content_type attribute or a file-extension-like id that can
be used to determine content type.
- HTTP HEAD handling was inconsistent for collections, depending
on whether the "default document" (index_html) was acquired or
not.
Zope 2.2.0 alpha 1
Features Changed
......
......@@ -82,8 +82,8 @@
# attributions are listed in the accompanying credits file.
#
##############################################################################
'''$Id: DT_Util.py,v 1.66 2000/05/30 15:59:50 brian Exp $'''
__version__='$Revision: 1.66 $'[11:-2]
'''$Id: DT_Util.py,v 1.67 2000/06/16 19:31:37 shane Exp $'''
__version__='$Revision: 1.67 $'[11:-2]
import regex, string, math, os
from string import strip, join, atoi, lower, split, find
......@@ -208,7 +208,6 @@ import string, math, whrandom
try:
import ExtensionClass
from cDocumentTemplate import InstanceDict, TemplateDict, render_blocks
from cDocumentTemplate import cDocument
except: from pDocumentTemplate import InstanceDict, TemplateDict, render_blocks
......@@ -260,12 +259,7 @@ class namespace_:
def namespace(self, **kw):
"""Create a tuple consisting of a single instance whos attributes are
provided as keyword arguments."""
try: return self(kw) # Try to use the cDocumentTemplate implementation.
except AttributeError:
r=namespace_()
d=r.__dict__
for k, v in kw.items(): d[k]=v
return r,
return apply(self, (), kw)
d['namespace']=namespace
......
......@@ -84,7 +84,7 @@
****************************************************************************/
static char cDocumentTemplate_module_documentation[] =
""
"\n$Id: cDocumentTemplate.c,v 1.32 2000/05/11 18:54:14 jim Exp $"
"\n$Id: cDocumentTemplate.c,v 1.33 2000/06/16 19:31:37 shane Exp $"
;
#include "ExtensionClass.h"
......@@ -611,7 +611,7 @@ newDictInstance(PyObject *data)
static PyObject *
MM_call(MM *self, PyObject *args, PyObject *kw)
{
PyObject *r;
PyObject *r, *t;
int i, l=0;
if (args && (l=PyTuple_Size(args)) < 0) return NULL;
......@@ -635,7 +635,9 @@ MM_call(MM *self, PyObject *args, PyObject *kw)
}
ASSIGN(r, OBJECT(newDictInstance(r)));
return r;
UNLESS(t=PyTuple_New(1)) goto err;
PyTuple_SET_ITEM(t, 0, r);
return t;
err:
Py_XDECREF(r);
......@@ -872,201 +874,11 @@ static struct PyMethodDef Module_Level__methods[] = {
{NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
};
static PyObject *
validate(PyObject *self, PyObject *args)
{
PyObject *inst, *parent, *name, *value, *md, *__roles__, *i, *p;
char *cname="";
long ir;
/* def validate(self, inst, parent, name, value, md): */
UNLESS(PyArg_ParseTuple(args,"OOOOO",&inst,&parent,&name,&value,&md))
return NULL;
if (PyString_Check(name))
{
UNLESS(cname=PyString_AsString(name)) return NULL;
if (*cname=='a' && cname[1]=='q' && cname[2]=='_'
&& strcmp(cname, "aq_explicit") && strcmp(cname, "aq_parent"))
/* We disallow names beginning with "aq_" unless they are
aq_parent or aq_explicit */
return PyInt_FromLong(0);
}
/*
if hasattr(value, '__roles__'): roles=value.__roles__
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__
elif hasattr(parent, 'aq_acquire'):
try: roles=parent.aq_acquire('__roles__')
except AttributeError:
if hasattr(inst, 'aq_base'): inst=inst.aq_base
if hasattr(parent, 'aq_base'): parent=parent.aq_base
return inst is parent
else:
if hasattr(inst, 'aq_base'): inst=inst.aq_base
if hasattr(parent, 'aq_base'): parent=parent.aq_base
return inst is parent
value=parent
*/
UNLESS(__roles__=PyObject_GetAttr(value,py___roles__))
{
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__))
{
PyErr_Clear();
if (__roles__=PyObject_GetAttr(parent,py_acquire))
{
ASSIGN(__roles__,
PyObject_CallFunction(__roles__, "O", py___roles__));
}
}
value=parent;
}
if (! __roles__)
{
PyErr_Clear();
/* Waaaa, check for wrapped objects, waaaaa! */
UNLESS(i=PyObject_GetAttr(inst, py_aq_base))
{
PyErr_Clear();
Py_INCREF(inst);
i=inst;
}
UNLESS(p=PyObject_GetAttr(parent, py_aq_base))
{
PyErr_Clear();
Py_INCREF(parent);
p=parent;
}
ir = i==p;
Py_DECREF(i);
Py_DECREF(p);
return PyInt_FromLong(ir);
}
/* if roles is None: return 1 */
if (__roles__==Py_None)
{
Py_DECREF(__roles__);
return PyInt_FromLong(1);
}
/* try:
if md.AUTHENTICATED_USER.hasRole(value, roles):
return 1
except AttributeError: pass
*/
if (md=PyObject_GetAttr(md,py_AUTHENTICATED_USER))
{
ASSIGN(md,PyObject_GetAttr(md,py_hasRole));
if (md) ASSIGN(md,PyObject_CallFunction(md,"OO",value,__roles__));
if (md)
{
if (PyObject_IsTrue(md))
{
Py_DECREF(__roles__);
return md;
}
Py_DECREF(md);
}
else PyErr_Clear();
}
else PyErr_Clear();
/* for r in self._proxy_roles:
if r in roles: return 1
*/
if (PyObject_IsTrue(__roles__))
if ((md=PyObject_GetAttr(self, py__proxy_roles)))
{
int i,l, isIn;
PyObject *role;
if ((l=PyObject_Length(md)) < 0) PyErr_Clear();
else
{
for (i=0; i < l; i++)
{
UNLESS(role=PySequence_GetItem(md,i))
{
PyErr_Clear();
break;
}
isIn=PySequence_In(__roles__,role);
Py_DECREF(role);
if (isIn < 0)
{
PyErr_Clear();
break;
}
if (isIn)
{
Py_DECREF(md);
return __roles__; /* Any true object would do. */
}
}
}
Py_DECREF(md);
}
else PyErr_Clear();
Py_DECREF(__roles__);
/* raise 'Unauthorized', (
'You are not authorized to access <em>%s</em>.' % name)
*/
if (name=PyString_Format(py_Unauthorized_fmt, name))
{
PyErr_SetObject(py_Unauthorized, name);
Py_DECREF(name);
}
return NULL;
}
static struct PyMethodDef Document_methods[] = {
{"validate", (PyCFunction)validate, METH_VARARGS,
""},
{NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initcDocumentTemplate) */
void
initcDocumentTemplate()
{
PyObject *m, *d;
char *rev="$Revision: 1.32 $";
PURE_MIXIN_CLASS(cDocument,
"Base class for documents that adds fast validation method",
Document_methods);
char *rev="$Revision: 1.33 $";
DictInstanceType.ob_type=&PyType_Type;
......@@ -1100,7 +912,6 @@ initcDocumentTemplate()
d = PyModule_GetDict(m);
PyExtensionClass_Export(d,"cDocument",cDocumentType);
PyExtensionClass_Export(d,"InstanceDict",InstanceDictType);
PyExtensionClass_Export(d,"TemplateDict",MMtype);
......
......@@ -85,8 +85,8 @@
__doc__='''Python implementations of document template some features
$Id: pDocumentTemplate.py,v 1.23 1999/03/10 00:15:08 klm Exp $'''
__version__='$Revision: 1.23 $'[11:-2]
$Id: pDocumentTemplate.py,v 1.24 2000/06/16 19:31:37 shane Exp $'''
__version__='$Revision: 1.24 $'[11:-2]
import string, sys, types
from string import join
......@@ -175,6 +175,15 @@ class MultiMapping:
kz = kz + d.keys()
return kz
class DictInstance:
def __init__(self, mapping):
self.__d=mapping
def __getattr__(self, name):
try: return self.__d[name]
except KeyError: raise AttributeError, name
class TemplateDict:
level=0
......@@ -220,6 +229,17 @@ class TemplateDict:
getitem=__getitem__
def __call__(self, *args, **kw):
if args:
if len(args)==1 and not kw:
m=args[0]
else:
m=self.__class__()
for a in args: m._push(a)
if kw: m._push(kw)
else: m=kw
return DictInstance(m)
def render_blocks(blocks, md):
rendered = []
append=rendered.append
......
......@@ -84,14 +84,13 @@
##############################################################################
"""DTML Method objects."""
__version__='$Revision: 1.48 $'[11:-2]
__version__='$Revision: 1.49 $'[11:-2]
import History
from Globals import HTML, HTMLFile, MessageDialog
from string import join,split,strip,rfind,atoi,lower
from SimpleItem import Item_w__name__, pretty_tb
from OFS.content_types import guess_content_type
from DocumentTemplate.DT_Util import cDocument
from PropertyManager import PropertyManager
from AccessControl.Role import RoleManager
from webdav.common import rfc1123_date
......@@ -103,7 +102,7 @@ from AccessControl import getSecurityManager
class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager,
class DTMLMethod(HTML, Acquisition.Implicit, RoleManager,
ElementWithTitle, Item_w__name__,
History.Historical,
):
......
......@@ -83,14 +83,14 @@
#
##############################################################################
__doc__="""Find support"""
__version__='$Revision: 1.16 $'[11:-2]
__version__='$Revision: 1.17 $'[11:-2]
import sys, os, string, time, Globals, ExtensionClass
from DocumentTemplate.DT_Util import Eval, expr_globals
from AccessControl.Permission import name_trans
from Globals import HTMLFile
from DocumentTemplate.DT_Util import InstanceDict, TemplateDict, cDocument
from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
from DateTime import DateTime
from string import find
from AccessControl import getSecurityManager
......
......@@ -94,7 +94,7 @@ import string, regex, urlparse, urllib, os, sys, time
import Products
from Acquisition import Implicit
from Persistence import Persistent
from DocumentTemplate.DT_Util import InstanceDict, TemplateDict, cDocument
from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
from DocumentTemplate.DT_Util import Eval, expr_globals
from AccessControl.Permission import name_trans
from Catalog import Catalog, orify
......
......@@ -85,8 +85,8 @@
__doc__='''Generic Database adapter
$Id: DA.py,v 1.86 2000/05/23 19:20:20 brian Exp $'''
__version__='$Revision: 1.86 $'[11:-2]
$Id: DA.py,v 1.87 2000/06/16 19:31:38 shane Exp $'''
__version__='$Revision: 1.87 $'[11:-2]
import OFS.SimpleItem, Aqueduct, RDB
import DocumentTemplate, marshal, md5, base64, Acquisition, os
......@@ -97,7 +97,6 @@ from cStringIO import StringIO
import sys, Globals, OFS.SimpleItem, AccessControl.Role
from string import atoi, find, join, split
import DocumentTemplate, sqlvar, sqltest, sqlgroup
from DocumentTemplate.DT_Util import cDocument
from time import time
from zlib import compress, decompress
from DateTime.DateTime import DateTime
......@@ -124,11 +123,11 @@ class nvSQL(DocumentTemplate.HTML):
_proxy_roles=()
class SQL(cDocument, nvSQL):
class SQL(nvSQL):
# Validating SQL template for Zope SQL Methods.
pass
def validate(self, inst, parent, name, value, md):
return getSecurityManager().validate(inst, parent, name, value)
class DA(
Aqueduct.BaseQuery,Acquisition.Implicit,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment