def __getattr__(self, name):
if self._state not in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>if name not in self._resources:<EOL><INDENT>if self._state not in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>resource = self.data_manager.get_resource(name)<EOL>if resource:<EOL><INDENT>self._resource_generators[name] = resource(self)<EOL>try:<EOL><INDENT>self._resources[name] = next(self._resource_generators[name])<EOL><DEDENT>except StopIteration:<EOL><INDENT>raise ResourceSetupException('<STR_LIT>'.format(resource))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise AttributeError('<STR_LIT>'.format(name))<EOL><DEDENT><DEDENT>return self._resources[name]<EOL>
Gets a Resource from the DataManager and initializes
it for the request.