'Process request'

def process_request(self, request):

    hmodules = dict()
    for module in settings.INSTALLED_APPS:
        import_name = ((str(module) + '.') + settings.HARDTREE_MODULE_IDENTIFIER)
        try:
            hmodule = __import__(import_name, fromlist=[str(module)])
            hmodules[str(module)] = hmodule.PROPERTIES
        except ImportError:
            pass
        except AttributeError:
            pass
    dbmodules = Module.objects.all()
    for dbmodule in dbmodules:
        if (dbmodule.name not in hmodules):
            dbmodule.delete()
        else:
            differ = False
            hmodule = dbmodule.name
            if (dbmodule.title != hmodules[hmodule]['title']):
                dbmodule.title = hmodules[hmodule]['title']
                differ = True
            if (dbmodule.url != hmodules[hmodule]['url']):
                dbmodule.url = hmodules[hmodule]['url']
                differ = True
            if (dbmodule.details != hmodules[hmodule]['details']):
                dbmodule.details = hmodules[hmodule]['details']
                differ = True
            if (dbmodule.system != hmodules[hmodule]['system']):
                dbmodule.system = hmodules[hmodule]['system']
                differ = True
            if differ:
                dbmodule.save()
    for hmodule in hmodules:
        dbmodule = None
        try:
            dbmodule = Module.objects.get(name=hmodule)
        except Module.DoesNotExist:
            pass
        except Module.MultipleObjectsReturned:
            Module.objects.filter(name=hmodule).delete()
        if (not dbmodule):
            dbmodule = Module(name=hmodule, title=hmodules[hmodule]['title'], url=hmodules[hmodule]['url'], details=hmodules[hmodule]['details'], system=hmodules[hmodule]['system'])
            dbmodule.save()
            dbmodule.set_default_user()
