danielgtaylor / malt.io

Malt.io free community for brewers
26 stars 11 forks source link

Recipe import failure #77

Open dkoppenh opened 11 years ago

dkoppenh commented 11 years ago

I successfully imported 2 recipes from brewtoad, but the third is failing with a 500 server error. XML is here http://www.brewtoad.com/recipes/before-the-storm-midwest-supplies-california-steam.xml

danielgtaylor commented 11 years ago

Looks like the following stack trace explains the issue:

'NoneType' object has no attribute 'lower'
Traceback (most recent call last):
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
    rv = self.router.dispatch(request, response)
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/base/data/home/apps/s~maltioweb/1.366489845268558639/handlers/base.py", line 22, in dispatch
    super(BaseHandler, self).dispatch()
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "/base/data/home/apps/s~maltioweb/1.366489845268558639/handlers/recipes.py", line 92, in post
    for recipe in Recipe.new_from_beerxml(recipesxml):
  File "/base/data/home/apps/s~maltioweb/1.366489845268558639/models/recipe.py", line 585, in new_from_beerxml
    f['late'] = fermentable_member.text.lower() == 'true' and 'y' or ''
AttributeError: 'NoneType' object has no attribute 'lower'

I'll see what I can do to fix it.

dkoppenh commented 10 years ago

FWIW, here's a diff -u between the XML that failed, and a modified one that succeeded.

--- before-the-storm-midwest-supplies - orig.xml        2013-06-24 18:43:17 -0400
+++ before-the-storm-midwest-supplies - good.xml        2013-05-14 19:01:18 -0400
@@ -87,13 +87,13 @@
         <POTENTIAL>1.03</POTENTIAL>
         <COLOR>8</COLOR>
         <DISPLAY_COLOR>8 SRM</DISPLAY_COLOR>
-        <ADD_AFTER_BOIL>false</ADD_AFTER_BOIL>
-        <COARSE_FINE_DIFF>0.0</COARSE_FINE_DIFF>
-        <MOISTURE></MOISTURE>
+        <ADD_AFTER_BOIL nil="true"></ADD_AFTER_BOIL>
+        <COARSE_FINE_DIFF nil="true"></COARSE_FINE_DIFF>
+        <MOISTURE nil="true"></MOISTURE>
         <DIASTATIC_POWER nil="true"></DIASTATIC_POWER>
         <PROTEIN nil="true"></PROTEIN>
         <MAX_IN_BATCH nil="true"></MAX_IN_BATCH>
-        <RECOMMEND_MASH>true</RECOMMEND_MASH>
+        <RECOMMEND_MASH nil="true"></RECOMMEND_MASH>
         <IBU_GAL_PER_LB nil="true"></IBU_GAL_PER_LB>
         <NOTES nil="true"></NOTES>
       </FERMENTABLE>