Permalink
Browse files

fixed problems with missing default attributes in sequence schema types

  • Loading branch information...
1 parent 667e700 commit aa5bb0eac8049c439e8ea89169428acf9e2e43b4 Tim Parkin committed Feb 16, 2010
Showing with 5 additions and 7 deletions.
  1. +1 −1 schemaish.egg-info/PKG-INFO
  2. +3 −5 schemaish/attr.py
  3. +1 −1 setup.py
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: schemaish
-Version: 0.5.5
+Version: 0.5.6
Summary: Schemaish is a simple schema library.
Home-page: http://schema.ish.io
Author: Tim Parkin, Matt Goodall
View
@@ -78,8 +78,6 @@ def __init__(self, **k):
validator = k.pop('validator', _MISSING)
if validator is not _MISSING:
self.validator = validator
- if k:
- raise TypeError('unsupported keywords passed to schemaish.attr.Attribute or subclass %r'%k.keys())
def validate(self, value):
"""
@@ -100,7 +98,7 @@ def __repr__(self):
attributes.append('description=%r' % self.description)
if self.validator:
attributes.append('validator=%r'% self.validator)
- if hasattr(self, 'default'):
+ if hasattr(self, 'default') and self.default:
attributes.append('default=%r' % self.default)
return 'schemaish.%s(%s)' % (self.__class__.__name__,
', '.join(attributes))
@@ -258,7 +256,7 @@ def add(self, attr):
@property
def default(self):
- return tuple( [a.default for a in self.attrs] )
+ return tuple( [getattr(a,'default',None) for a in self.attrs] )
def validate(self, value):
"""
@@ -360,7 +358,7 @@ def get(self, name):
@property
def default(self):
- return dict( [(name, a.default) for name, a in self.attrs] )
+ return dict( [(name, getattr(a,'default',None)) for name, a in self.attrs] )
def validate(self, value):
"""
View
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import sys, os
-version = '0.5.5'
+version = '0.5.6'
setup(name='schemaish',
version=version,

0 comments on commit aa5bb0e

Please sign in to comment.