from django.http import HttpResponse
import logging
from test_utils.testmaker import Testmaker

def set_logging(request, filename=None):
    if not filename:
        filename = request.REQUEST['filename']
    log_file = '/tmp/testmaker/tests/%s_tests_custom.py' % filename
    serialize_file = '/tmp/testmaker/tests/%s_serial_custm.py' % filename
    tm = Testmaker()
    tm.setup_logging(test_file=log_file, serialize_file=serialize_file)
    tm.prepare_test_file()
    return HttpResponse('Setup logging %s' % tm.test_file)

def show_log(request):
    file = Testmaker.logfile()
    contents = open(file)
    return HttpResponse(contents.read(), content_type='text/plain')
    HttpResponse()

from django.http import HttpResponse

import logging

from test_utils.testmaker.processors.base import slugify
from test_utils.testmaker import Testmaker

def set_logging(request, filename=None):
    if not filename:
        filename = request.REQUEST['filename']
    filename = slugify(filename)
    log_file = '/tmp/testmaker/tests/%s_tests_custom.py' % filename
    serialize_file = '/tmp/testmaker/tests/%s_serial_custm.py' % filename
    tm = Testmaker()
    tm.setup_logging(test_file=log_file, serialize_file=serialize_file)
    tm.prepare_test_file()
    return HttpResponse('Setup logging %s' % tm.test_file)

def show_log(request):
    file = Testmaker.logfile()
    contents = open(file)
    return HttpResponse(contents.read(), content_type='text/plain')
    HttpResponse()

Use slugify to filenameify the strings passed in. This should probably live in a test_utils.utils. Too many utils!
Use slugify to filenameify the strings passed in. This should probably live in a test_utils.utils. Too many utils!
  from django.http import HttpResponse
+ 
  import logging
+ 
+ from test_utils.testmaker.processors.base import slugify
  from test_utils.testmaker import Testmaker
  
  def set_logging(request, filename=None):
      if not filename:
          filename = request.REQUEST['filename']
+     filename = slugify(filename)
      log_file = '/tmp/testmaker/tests/%s_tests_custom.py' % filename
      serialize_file = '/tmp/testmaker/tests/%s_serial_custm.py' % filename
      tm = Testmaker()
      tm.setup_logging(test_file=log_file, serialize_file=serialize_file)
      tm.prepare_test_file()
      return HttpResponse('Setup logging %s' % tm.test_file)
  
  def show_log(request):
      file = Testmaker.logfile()
      contents = open(file)
      return HttpResponse(contents.read(), content_type='text/plain')
      HttpResponse()
  
Use slugify to filenameify the strings passed in. This should probably live in a test_utils.utils. Too many utils!
## Code Before:
from django.http import HttpResponse
import logging
from test_utils.testmaker import Testmaker

def set_logging(request, filename=None):
    if not filename:
        filename = request.REQUEST['filename']
    log_file = '/tmp/testmaker/tests/%s_tests_custom.py' % filename
    serialize_file = '/tmp/testmaker/tests/%s_serial_custm.py' % filename
    tm = Testmaker()
    tm.setup_logging(test_file=log_file, serialize_file=serialize_file)
    tm.prepare_test_file()
    return HttpResponse('Setup logging %s' % tm.test_file)

def show_log(request):
    file = Testmaker.logfile()
    contents = open(file)
    return HttpResponse(contents.read(), content_type='text/plain')
    HttpResponse()

## Instruction:
Use slugify to filenameify the strings passed in. This should probably live in a test_utils.utils. Too many utils!
## Code After:
from django.http import HttpResponse

import logging

from test_utils.testmaker.processors.base import slugify
from test_utils.testmaker import Testmaker

def set_logging(request, filename=None):
    if not filename:
        filename = request.REQUEST['filename']
    filename = slugify(filename)
    log_file = '/tmp/testmaker/tests/%s_tests_custom.py' % filename
    serialize_file = '/tmp/testmaker/tests/%s_serial_custm.py' % filename
    tm = Testmaker()
    tm.setup_logging(test_file=log_file, serialize_file=serialize_file)
    tm.prepare_test_file()
    return HttpResponse('Setup logging %s' % tm.test_file)

def show_log(request):
    file = Testmaker.logfile()
    contents = open(file)
    return HttpResponse(contents.read(), content_type='text/plain')
    HttpResponse()
