def get_directory_name(job):
    """
      Expected format:
      %sharedPath%watchedDirectories/workFlowDecisions/createDip/ImagesSIP-69826e50-87a2-4370-b7bd-406fc8aad94f/
    """
    import re

    directory = job.directory
    uuid = job.sipuuid

    try:
        return re.search(r'^.*/(?P<directory>.*)-[\w]{8}(-[\w]{4}){3}-[\w]{12}[/]{0,1}$', directory).group('directory')
    except:
        pass

    try:
        return re.search(r'^.*/(?P<directory>.*)/$', directory).group('directory')
    except:
        pass

    if directory:
        return directory
    else:
        return uuid

from django.shortcuts import render_to_response
from django.template.context import RequestContext

def render(request, template, context={}):
    return render_to_response(template, context, context_instance=RequestContext(request))

def get_directory_name(job):
    """
      Expected format:
      %sharedPath%watchedDirectories/workFlowDecisions/createDip/ImagesSIP-69826e50-87a2-4370-b7bd-406fc8aad94f/
    """
    import re

    directory = job.directory
    uuid = job.sipuuid

    try:
        return re.search(r'^.*/(?P<directory>.*)-[\w]{8}(-[\w]{4}){3}-[\w]{12}[/]{0,1}$', directory).group('directory')
    except:
        pass

    try:
        return re.search(r'^.*/(?P<directory>.*)/$', directory).group('directory')
    except:
        pass

    if directory:
        return directory
    else:
        return uuid

Add wrapper for render_to_resposne to include tmpl context processors easily
Add wrapper for render_to_resposne to include tmpl context processors easily

Autoconverted from SVN (revision:2231)

+ from django.shortcuts import render_to_response
+ from django.template.context import RequestContext
+ 
+ def render(request, template, context={}):
+     return render_to_response(template, context, context_instance=RequestContext(request))
+ 
  def get_directory_name(job):
      """
        Expected format:
        %sharedPath%watchedDirectories/workFlowDecisions/createDip/ImagesSIP-69826e50-87a2-4370-b7bd-406fc8aad94f/
      """
      import re
  
      directory = job.directory
      uuid = job.sipuuid
  
      try:
          return re.search(r'^.*/(?P<directory>.*)-[\w]{8}(-[\w]{4}){3}-[\w]{12}[/]{0,1}$', directory).group('directory')
      except:
          pass
  
      try:
          return re.search(r'^.*/(?P<directory>.*)/$', directory).group('directory')
      except:
          pass
  
      if directory:
          return directory
      else:
          return uuid
  
Add wrapper for render_to_resposne to include tmpl context processors easily
## Code Before:
def get_directory_name(job):
    """
      Expected format:
      %sharedPath%watchedDirectories/workFlowDecisions/createDip/ImagesSIP-69826e50-87a2-4370-b7bd-406fc8aad94f/
    """
    import re

    directory = job.directory
    uuid = job.sipuuid

    try:
        return re.search(r'^.*/(?P<directory>.*)-[\w]{8}(-[\w]{4}){3}-[\w]{12}[/]{0,1}$', directory).group('directory')
    except:
        pass

    try:
        return re.search(r'^.*/(?P<directory>.*)/$', directory).group('directory')
    except:
        pass

    if directory:
        return directory
    else:
        return uuid

## Instruction:
Add wrapper for render_to_resposne to include tmpl context processors easily
## Code After:
from django.shortcuts import render_to_response
from django.template.context import RequestContext

def render(request, template, context={}):
    return render_to_response(template, context, context_instance=RequestContext(request))

def get_directory_name(job):
    """
      Expected format:
      %sharedPath%watchedDirectories/workFlowDecisions/createDip/ImagesSIP-69826e50-87a2-4370-b7bd-406fc8aad94f/
    """
    import re

    directory = job.directory
    uuid = job.sipuuid

    try:
        return re.search(r'^.*/(?P<directory>.*)-[\w]{8}(-[\w]{4}){3}-[\w]{12}[/]{0,1}$', directory).group('directory')
    except:
        pass

    try:
        return re.search(r'^.*/(?P<directory>.*)/$', directory).group('directory')
    except:
        pass

    if directory:
        return directory
    else:
        return uuid
