How to replace app engine modelclass.properties() with Django functions?
I am looking at the challenges in converting a codebase from using [app engine patch][1] to using [django-nonrel][2].

One of the things that happens in this codebase several times is iterating over all properties of an entity.  For example, comparator, copy constructor, \__str__ equivalent, and so on.

Simplified example:

    def compare_things(thing_a, thing_b):
      '''Compare two things on properties not in Thing.COMPARE_IGNORE_PROPS'''
      if type(thing_a) != type(thing_b): return "Internal error"

      for prop in Thing.properties():
        if prop not in Thing.COMPARE_IGNORE_PROPS:
          attr_a = getattr(thing_a, prop)
          attr_b = getattr(thing_b, prop)
          if attr_a != attr_b:
            return prop + ": " + str(attr_a) + " is not equal to " + str(attr_b)
      return ''


However, the properties() function is from google.appengine.ext.db.Model.

If I wish to use django-nonrel, all my model objects will be instead from django.db.models.Model.

Is there an equivalent functionality in that class?


  [1]: http://code.google.com/p/app-engine-patch/
  [2]: http://www.allbuttonspressed.com/projects/django-nonrel
How to replace app engine modelclass.properties() with Django functions?
===

I am looking at the challenges in converting a codebase from using [app engine patch][1] to using [django-nonrel][2].

One of the things that happens in this codebase several times is iterating over all properties of an entity.  For example, comparator, copy constructor, \__str__ equivalent, and so on.

Simplified example:

    def compare_things(thing_a, thing_b):
      '''Compare two things on properties not in Thing.COMPARE_IGNORE_PROPS'''
      if type(thing_a) != type(thing_b): return "Internal error"

      for prop in Thing.properties():
        if prop not in Thing.COMPARE_IGNORE_PROPS:
          attr_a = getattr(thing_a, prop)
          attr_b = getattr(thing_b, prop)
          if attr_a != attr_b:
            return prop + ": " + str(attr_a) + " is not equal to " + str(attr_b)
      return ''


However, the properties() function is from google.appengine.ext.db.Model.

If I wish to use django-nonrel, all my model objects will be instead from django.db.models.Model.

Is there an equivalent functionality in that class?


  [1]: http://code.google.com/p/app-engine-patch/
  [2]: http://www.allbuttonspressed.com/projects/django-nonrel