HomePhabricator

Make family classes singletons

Description

Make family classes singletons

Families are realistically singletons because multiple instances
for the same family simply make no sense. See my complaints on:
https://gerrit.wikimedia.org/r/#/c/429875/3

Family is made a basic singleton class (not using metaclass). It
will refuse to create more than one instances of the same class
without hacks such as programmatically overwriting or deleting
class attributes / methods.

The exception to this rule is AutoFamily, which needs many
instances in order to represent sites with different uris. This
AutoFamily isreplaced with a dynamic class generator via 3-argument
type() constructor call, generating singleton classes.

Many instance initialization logic is now flattened to the class
code, with few exceptions that depend on parent class, in which case
they are converted to classproperties. The majority of instance
properties are also converted to class properties.

Change-Id: I2a3cb83c5fb6fb3648c9ef2e08313cf77dbb9c29

Details

Provenance
zhuyifei1999Authored on May 18 2018, 10:09 AM
Parents
rPWBC31b57839126a: Merge "[doc] Update HISTORY.rst file"
Branches
Unknown
Tags
Unknown
ChangeId
I2a3cb83c5fb6fb3648c9ef2e08313cf77dbb9c29