scrapy/scrapy — pull request #662 by TamerTas (2014-03-20 07:25:29+00:00)
Title: refactor _iter_command_classes and iter_spider_classes

In ```scrapy.utils.cmdline``` and ```scrapy.utils.spider``` there were 2 almost duplicate functions (```iter_command_classes```, ```iter_spider_classes```) that returns an iterator over the given module.

I refactored it into ```iter_classes``` iterator that resides in ```scrapy.utils.iterators``` and changed the uses of the former 2 functions throughout the source code to the new ```iter_classes``` iterator.

If the iterator is supplied with a valid filepath of a ```.py``` module and ```is_path=True``` argument, it loads the source file and returns the instantiable modules if there are problems with loading the source file it throws ```UsageError``` if it encounters an ```ImportError``` or ```ValueError```.

I've ran the tests and examined the code carefully. But, I might have missed something. So, please let me know if there are any problems and then I can make the necessary changes