from __future__ import unicode_literals

class Meta(object):
    '''Generic container for Meta classes'''

    def __new__(cls, meta=None):
        # Return a new class base on ourselves
        attrs = dict(
            (name, getattr(meta, name))
            for name in dir(meta)
            if not name[0] == '_'
        )
        return object.__new__(type(str('Meta'), (cls,), attrs))

from __future__ import unicode_literals

class Meta(object):
    '''Generic container for Meta classes'''

    def __new__(cls, meta=None):
        # Return a new class base on ourselves
        attrs = dict(
            (name, getattr(meta, name))
            for name in dir(meta)
            if not name[0] == '_' and hasattr(cls, name)
        )
        return object.__new__(type(str('Meta'), (cls,), attrs))

Make Meta class enforce only known properties
Make Meta class enforce only known properties

  from __future__ import unicode_literals
  
  class Meta(object):
      '''Generic container for Meta classes'''
  
      def __new__(cls, meta=None):
          # Return a new class base on ourselves
          attrs = dict(
              (name, getattr(meta, name))
              for name in dir(meta)
-             if not name[0] == '_'
+             if not name[0] == '_' and hasattr(cls, name)
          )
          return object.__new__(type(str('Meta'), (cls,), attrs))
  
Make Meta class enforce only known properties
## Code Before:
from __future__ import unicode_literals

class Meta(object):
    '''Generic container for Meta classes'''

    def __new__(cls, meta=None):
        # Return a new class base on ourselves
        attrs = dict(
            (name, getattr(meta, name))
            for name in dir(meta)
            if not name[0] == '_'
        )
        return object.__new__(type(str('Meta'), (cls,), attrs))

## Instruction:
Make Meta class enforce only known properties
## Code After:
from __future__ import unicode_literals

class Meta(object):
    '''Generic container for Meta classes'''

    def __new__(cls, meta=None):
        # Return a new class base on ourselves
        attrs = dict(
            (name, getattr(meta, name))
            for name in dir(meta)
            if not name[0] == '_' and hasattr(cls, name)
        )
        return object.__new__(type(str('Meta'), (cls,), attrs))
