Felipe Vieira avatar Felipe Vieira committed 52f13bd

Fixed bug and ran tests without errors

Comments (0)

Files changed (2)

         Creates or updates BaseChoice(s) attribute(s) for given entity.
         """
 
+        # value can be None to reset choices from schema
+        if value == None:
+            value = []
+
         if not hasattr(value, '__iter__'):
             value = [value]
 
 >>> e2.save()
 Traceback (most recent call last):
     ...
-TypeError: Cannot assign [\'wrong choice\']: "Attr.choice" must be a BaseChoice instance.
+TypeError: Cannot assign "[\'wrong choice\']": "Attr.choice" must be a BaseChoice instance.
 >>> e2.size = [small, large]
 >>> e2.save()
 >>> e3 = Entity.objects.get(pk=e.pk)
 >>> egg_albumen
 <Choice: Egg Albumen>
 >>> gluten.schema
-<Schema: Protein (choices)>
+<Schema: Protein (choice)>
 >>> e = Entity(title='Cane')
 >>> e.protein = egg_albumen
 >>> e.save()
 >>> e2.save()
 Traceback (most recent call last):
     ...
-TypeError: Cannot assign multiple values [Choice: Gluten>, <Choice: Lean Meat>] to TYPE_ONE: must be only one BaseChoice instance.
+TypeError: Cannot assign multiple values "[<Choice: Gluten>, <Choice: Lean Meat>]" to TYPE_ONE must be only one BaseChoice instance.
 >>> e3 = Entity.objects.get(pk=e.pk)
 >>> e3.protein
 <Choice: Egg Albumen>
 >>> e2.save()
 Traceback (most recent call last):
     ...
-TypeError: Cannot assign [\'wrong choice\']: "Attr.choice" must be a BaseChoice instance.
+TypeError: Cannot assign "[\'wrong choice\']": "Attr.choice" must be a BaseChoice instance.
 
 ##
 ## combined
 # or don't have any attributes for this schema at all:
 #
 >>> Entity.objects.exclude(size=small)
-[<Entity: Apple>, <Entity: Orange>, <Entity: Old Dog>]
+[<Entity: Apple>, <Entity: Cane>, <Entity: Orange>, <Entity: Old Dog>]
 >>> Entity.objects.exclude(taste='sweet')
-[<Entity: T-shirt>, <Entity: Old Dog>]
+[<Entity: T-shirt>, <Entity: Cane>, <Entity: Old Dog>]
 >>> Entity.objects.filter(size=large) & Entity.objects.exclude(colour='orange')
 [<Entity: T-shirt>]
 >>> Entity.objects.filter(size=large) & Entity.objects.filter(colour='orange')
 >>> fs.facets
 [<TextFacet: Item price>, <TextFacet: Colour>, <ManyToManyFacet: Size>, <TextFacet: Taste>]
 >>> [x for x in fs]
-[<Entity: Apple>, <Entity: T-shirt>, <Entity: Orange>, <Entity: Tangerine>, <Entity: Old Dog>]
+[<Entity: Apple>, <Entity: T-shirt>, <Entity: Cane>, <Entity: Orange>, <Entity: Tangerine>, <Entity: Old Dog>]
 >>> [x for x in FacetSet({'colour': 'yellow'})]
 [<Entity: Apple>]
 >>> [x for x in FacetSet({'colour': 'orange'})]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.