Django

Code

Changeset 7585

Show
Ignore:
Timestamp:
06/07/08 15:01:18 (6 months ago)
Author:
jacob
Message:

Fixed #7342: Ignore any Meta options starting with '_', thus making it OK for Meta to be a newstyle class. Thanks, Gulopine.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/db/models/options.py

    r7478 r7585  
    5757        if self.meta: 
    5858            meta_attrs = self.meta.__dict__.copy() 
    59             del meta_attrs['__module__'] 
    60             del meta_attrs['__doc__'] 
     59            for name in self.meta.__dict__: 
     60                # Ignore any private attributes that Django doesn't care about. 
     61                # NOTE: We can't modify a dictionary's contents while looping 
     62                # over it, so we loop over the *original* dictionary instead. 
     63                if name.startswith('_'): 
     64                    del meta_attrs[name] 
    6165            for attr_name in DEFAULT_NAMES: 
    6266                if attr_name in meta_attrs: