def maintenance(period='daily'):
 maintenance = None
 result = 'NotImplementedError'
 templates = settings.get_template()
 if (templates != 'default'):
  template_location = settings.get_template_location()
  if (not isinstance(templates, (tuple, list))):
   templates = (templates,)
  for template in templates[::(-1)]:
   package = ('applications.%s.%s.templates.%s' % (appname, template_location, template))
   name = 'maintenance'
   try:
    maintenance = getattr(__import__(package, fromlist=[name]), name)
   except (ImportError, AttributeError):
    pass
   else:
    break
 if (maintenance is None):
  try:
   from templates.default import maintenance
  except ImportError:
   pass
 if (maintenance is not None):
  if (period == 'daily'):
   result = maintenance.Daily()()
  db.commit()
 return result

def maintenance ( period = 'daily' ) : maintenance = None result = 'NotImplementedError' templates = settings . get_template ( ) if ( templates != 'default' ) : template_location = settings . get_template_location ( ) if ( not isinstance ( templates , ( tuple , list ) ) ) : templates = ( templates , ) for template in templates [ : : ( - 1 ) ] : package = ( 'applications.%s.%s.templates.%s' % ( appname , template_location , template ) ) name = 'maintenance' try : maintenance = getattr ( __import__ ( package , fromlist = [ name ] ) , name ) except ( ImportError , AttributeError ) : pass else : break if ( maintenance is None ) : try : from templates . default import maintenance except ImportError : pass if ( maintenance is not None ) : if ( period == 'daily' ) : result = maintenance . Daily ( ) ( ) db . commit ( ) return result
run all maintenance tasks which should be done daily - these are read from the template .