BethanyG / NANA

4 stars 0 forks source link

Re-Write Majula's Kitchen Parser to be More Flexable #7

Open BethanyG opened 7 years ago

BethanyG commented 7 years ago

RecipeMaker.py -> Class ManjulasMaker(RecipeMaker)

The current implementation is brittle, and breaks when there are too many instructions or ingredients. This needs to be re-written to not 'barf' on longer recipes.

Input: http://www.manjulaskitchen.com/urad-dal-tadka/ Expected Output: Recipe and Analysis Actual Output:

TypeError: cannot concatenate 'str' and 'list' objects

File "/Users/bethanygarcia/anaconda3/envs/py27_TF/lib/python2.7/site-packages/flask/app.py", line 1997, in call return self.wsgi_app(environ, start_response) File "/Users/bethanygarcia/anaconda3/envs/py27_TF/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app response = self.handle_exception(e) File "/Users/bethanygarcia/anaconda3/envs/py27_TF/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/bethanygarcia/anaconda3/envs/py27_TF/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/Users/bethanygarcia/anaconda3/envs/py27_TF/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/bethanygarcia/anaconda3/envs/py27_TF/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/bethanygarcia/anaconda3/envs/py27_TF/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/Users/bethanygarcia/anaconda3/envs/py27_TF/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "/Users/bethanygarcia/NANA/server.py", line 54, in new_analysis_requested current_recipe = RecipeMaker.parse_recipe(recipe_url) File "/Users/bethanygarcia/NANA/RecipeMaker.py", line 111, in parse_recipe current_recipe = current_maker(url).process_url() File "/Users/bethanygarcia/NANA/RecipeMaker.py", line 227, in process_url self.maker_recipe.description += " " + additional_supplies TypeError: cannot concatenate 'str' and 'list' objects

BethanyG commented 7 years ago

Tagging this with a 3.6 Migration label, since there's probably no use in repairing this for 2.7.13 - the library has changed, as has the website, so it might be best to simply re-think the strategy in the 3.6_rewrite branch.