import json
import pystache


class HelloWorld():
    def __init__(self):
        with open('models/hello_world.json') as config_file:
            self.config = json.load(config_file)
            self.message = self.config['message']

    def process(self):
        renderer = pystache.Renderer(search_dirs='templates')

        with open('bin/hello_world.txt', 'w') as output_file:
            output_file.write(renderer.render(self))

import json
import pystache


class HelloWorld():
    def __init__(self):
        with open('models/hello_world.json') as config_file:
            # Map JSON properties to this object
            self.__dict__.update(json.load(config_file))

    def process(self):
        renderer = pystache.Renderer(search_dirs='templates')

        with open('bin/hello_world.txt', 'w') as output_file:
            output_file.write(renderer.render(self))

Copy config settings to task object automatically
Copy config settings to task object automatically

  import json
  import pystache
  
  
  class HelloWorld():
      def __init__(self):
          with open('models/hello_world.json') as config_file:
+             # Map JSON properties to this object
-             self.config = json.load(config_file)
+             self.__dict__.update(json.load(config_file))
-             self.message = self.config['message']
  
      def process(self):
          renderer = pystache.Renderer(search_dirs='templates')
  
          with open('bin/hello_world.txt', 'w') as output_file:
              output_file.write(renderer.render(self))
  
Copy config settings to task object automatically
## Code Before:
import json
import pystache


class HelloWorld():
    def __init__(self):
        with open('models/hello_world.json') as config_file:
            self.config = json.load(config_file)
            self.message = self.config['message']

    def process(self):
        renderer = pystache.Renderer(search_dirs='templates')

        with open('bin/hello_world.txt', 'w') as output_file:
            output_file.write(renderer.render(self))

## Instruction:
Copy config settings to task object automatically
## Code After:
import json
import pystache


class HelloWorld():
    def __init__(self):
        with open('models/hello_world.json') as config_file:
            # Map JSON properties to this object
            self.__dict__.update(json.load(config_file))

    def process(self):
        renderer = pystache.Renderer(search_dirs='templates')

        with open('bin/hello_world.txt', 'w') as output_file:
            output_file.write(renderer.render(self))
