def registerPagelets(required, newClass, provides, name, info): handler('registerAdapter', newClass, required, IPagelet, name, info) for iface in provides: if iface is IPagelet: continue if IPageletType.providedBy(iface): handler('registerAdapter', newClass, required, iface, '', info)
if not IFromUnicode.providedBy(field): raise ConfigurationError("Can't convert value", fname) setattr(new_class, fname, field.fromUnicode(kwargs[fname])) else: if field.required and not hasattr(new_class, fname): raise ConfigurationError("Required field is missing", fname) if not hasattr(new_class, fname): setattr(new_class, fname, field.default) # add IPagelet to provides if name: inProvides = False for iface in provides: if IPagelet.isOrExtends(iface) and not IPageletType.providedBy(iface): inProvides = True if not inProvides: provides.append(IPagelet) # Handle CheckerPublic if permission == 'zope.Public': permission = CheckerPublic # prepare allowed interfaces and attributes allowed_interface.extend(provides) allowed_interface.append(IBrowserPage) allowed_attributes.extend(kwargs.keys()) allowed_attributes.extend(('__call__', 'browserDefault', 'publishTraverse'))