Пример #1
0
    def mw_view_applicationDetails(request, view_func, view_args, view_kwargs):
        request.META['VERSION_MAJOR'] = settings.VERSION_MAJOR
        request.META['VERSION_MINOR'] = "%s%s" % (settings.VERSION_MINOR_1, settings.VERSION_MINOR_2)
        request.META['MEDIA_PRJ']     = settings.MEDIA_PRJ
        request.META['MEDIA_LIB']     = settings.MEDIA_LIB

        request.META['VIEW_KWARGS']   = view_kwargs
        
        splitList = (view_func.func_globals['__name__']).split('.',2)
        currentApp = splitList[0]
        currentView = view_func.func_name

##        # if we are in a node_ app then get extract currentApp from the url
##        # ex: from /besomeone/node_goal_a/view/view_boycott/ where view_boycott is the actual app 
##        if (currentApp[:5] == "node_") and (currentView[:10] == 'VIEW_Node_'):
##            splitAppFromUrlList = request.META[o_currentApp']     = currentApp

        request.META['auto_currentApp']             = currentApp
        request.META['auto_currentView']            = currentView
        convertedDict = convertClassNameToBaseAndVersion(request.META['auto_currentApp'])
        request.META['auto_currentApp_baseName']    = convertedDict['baseName']
        request.META['auto_currentApp_version']     = convertedDict['version']
        
        
##        print "request.META['auto_currentApp']             = %s" % (request.META['auto_currentApp'])
##        print "request.META['auto_currentView']            = %s" % (request.META['auto_currentView'])
##        print "request.META['auto_currentApp_baseName']    = %s" % (request.META['auto_currentApp_baseName'])
##        print "request.META['auto_currentApp_version']     = %s" % (request.META['auto_currentApp_version'])
        
        # default value - over riden by specific problems
        request.META['problem_banner'] = {'file': 'http://%s/%s/images/besomeone-text-transparent-583x100.png' % (request.META['duo_mapHost'], request.META['MEDIA_PRJ']), 'alt': 'be someone'}

        # set a default title but this should be overwritten in each view
        if request.META['duo_Direct']: 
            a_mgrApplication_03.setTitle(request)

        request.META['baseContext_linkHome']         = reverse(settings.HOME_VIEW, urlconf=getattr(request, "urlconf", settings.ROOT_URLCONF))
        request.META['RECAPTCHA_PUBLIC_KEY']         = settings.RECAPTCHA_PUBLIC_KEY   

        lastPagination_appName = request.session.get('lastPagination_appName')
        if lastPagination_appName and (lastPagination_appName <> request.META['auto_currentApp']+"_"+request.META['auto_currentView']):
            if '_sort_' in request.session: del request.session['_sort_']
            if '_page_' in request.session: del request.session['_page_']

        return None    
Пример #2
0
    def entryInit_class(cls):
        from a_mgrApplication_03.models_aux import registeredClassInfo        
        errorList          = []
        dependancyDict     = {}

        alwaysRequiredList = [
                                'a_base_02', 
                                'a_citizen_02',
#                                'a_friends_01',
                                'a_library_02',
#                                'a_geoAddress_01',
#                                'a_googleMap_01',
                                'a_mgrCache_01',
#                                'a_mdMigration_01',
                                'a_mgrApplication_03',
                                'a_mgrCategories_02',
                                'a_mgrEmail_02',
                                'a_msgSocial_02',
                                'a_msgUser_02',
#                                'a_mgrPublish_02',
                                'a_mgrSidebar_02',
                                'a_mgrVerHistory_01',
                                'a_update_02',
#                                'a_discussion_01',
                             ]

        for x in settings.INSTALLED_APPS:
            if x[:6] <> 'django': # skip the django installed apps
                knownComponent = True
                
                # Verify always required components are present
                if x[:2] == 'a_':
                    if x not in alwaysRequiredList:
                        errorList.append('module not in alwaysRequiredList: %s' % (x))
                # Gather dependencies for other components
                elif x[:2] in ['c_', 'd_', 'e_', 'v_', 'w_', 'p_', 'ev']:
                    convertedDict = convertClassNameToBaseAndVersion(x)
                    addComponent(convertedDict['baseName'], convertedDict['version'])
                    
###                    dependencyList = registeredClassInfo.get_classObject_fromBaseName(convertedDict['baseName']).entryInit_dependencies()
###                    if x not in dependancyDict:
###                        dependancyDict[x] = []
###                        for y in dependencyList:
###                            dependancyDict[x].append(y)
###                    else:
###                        errorList.append('module %s already found in dependencyDict' % (x))
                else:
                    if x == 'tagging' or x == 'compress': # small hack to allow the django tagging and compress modules I just started to use.
                        pass
                    else:
                        knownComponent = False
                        errorList.append('unknown module type (%s): %s' % (x[:2], x))

        # Verify dependencies are satisfied 
        for k, v in dependancyDict.items():
            for x in v:
                if x not in settings.INSTALLED_APPS:
                    errorList.append('component %s dependency %s not found' % (k, x))
                    
        if errorList:
            errorList.insert(0, "a_mgrApplication_03.entryInit_class")
            errorString = '\n*** '.join(errorList)
            raise Exception, errorString