benoitc / couchdbkit

CouchDB python framework
http://couchdbkit.org
Other
265 stars 94 forks source link

Remove DuplicatePropertyError #153

Open 198d opened 11 years ago

198d commented 11 years ago

It is sometimes desirable to redefine a property in a subclass (e.g. to override a default value set in parent class). This removes checks for duplicate properties when using a base class derived from schema.DocumentSchema.

We talked in #couchdbkit about overriding a default value for a property in a subclass. I had thought I might just be able to redefine the property in the subclass but ran into DuplicatePropertyError and as mentioned, here's a pull request.

Now, this goes to the extreme of just stripping that guard completely. As I was writing it, I thought, it might be worthwhile to, at the very least, make sure the property in the subclass was of the same type, but maybe not. I'd be interested in your thoughts on that.