(cls, name, bases=None, attr=None)
return newcls
Creates a new `PageObject` subclass.

        If `bases` and `attr` are specified, as in a regular subclass
        declaration, a new class is created as per the specified settings.

        If only `name` is specified, that value is used as a reference to a
        `RemoteObject` class to which the new `PageObject` class is bound.
        The `name` parameter can be either a name or a `RemoteObject` class,
        as when declaring a `remoteobjects.fields.Object` field.
Creates a new `PageObject` subclass.
Creates a new PageObject subclass .
def __new__(cls, name, bases=None, attr=None):
        """Creates a new `PageObject` subclass.

        If `bases` and `attr` are specified, as in a regular subclass
        declaration, a new class is created as per the specified settings.

        If only `name` is specified, that value is used as a reference to a
        `RemoteObject` class to which the new `PageObject` class is bound.
        The `name` parameter can be either a name or a `RemoteObject` class,
        as when declaring a `remoteobjects.fields.Object` field.

        """
        direct = attr is None
        if direct:
            # Don't bother making a new subclass if we already made one for
            # this target.
            if name in cls._subclasses:
                return cls._subclasses[name]

            entryclass = name
            if callable(entryclass):
                name = cls.__name__ + entryclass.__name__
            else:
                name = cls.__name__ + entryclass

            bases = (cls._basemodule,)

            attr = {
                'entries': fields.List(fields.Object(entryclass)),
            }

        newcls = super(PageOf, cls).__new__(cls, name, bases, attr)

        # Save the result for later direct invocations.
        if direct:
            cls._subclasses[entryclass] = newcls
            newcls.__module__ = cls._modulename
            setattr(sys.modules[cls._modulename], name, newcls)
        elif cls._basemodule is None:
            cls._basemodule = newcls

        return newcls
def __new__ ( cls , name , bases = None , attr = None ) : direct = attr is None if direct : # Don't bother making a new subclass if we already made one for # this target. if name in cls . _subclasses : return cls . _subclasses [ name ] entryclass = name if callable ( entryclass ) : name = cls . __name__ + entryclass . __name__ else : name = cls . __name__ + entryclass bases = ( cls . _basemodule , ) attr = { 'entries' : fields . List ( fields . Object ( entryclass ) ) , } newcls = super ( PageOf , cls ) . __new__ ( cls , name , bases , attr ) # Save the result for later direct invocations. if direct : cls . _subclasses [ entryclass ] = newcls newcls . __module__ = cls . _modulename setattr ( sys . modules [ cls . _modulename ] , name , newcls ) elif cls . _basemodule is None : cls . _basemodule = newcls return newcls