Skip to content

Correct the wrong usage of AccessControl.ZopeGuards.ContainerAssertions.

Tatuya Kamada requested to merge fix/allowing_in_restricted into master

This commit intend to fix the wrong usage of ContainerAssetions, otherwise we can not use the classes of datetime module since it is a C module.

wrong:

    ContainerAssertions(datetime.datetime) = 1

right:

   ContainerAssertions(type(datetime.datetime)) = 1

ContainerAssertions expects that the given parameter is a type.

Furthermore, allow_type() is the higher function which doing the same thing with asserting the given parameter data type.

The conclusion is that we should use allow_type when we want to allow classes inside a C module:

   allow_type(type(datetime.datetime))

@vpelletier Could you please review my patch?

/cc @klaus because the original reason of this fix is allowing datetime.datetime.strptime at a0925d5a

Merge request reports