def fStringFromContenidoDeUploadedFile( self, theContenidoUploadedFile):

        from Products.ModelDDvlPloneTool.ModelDDvlPloneToolSupport import fReprAsString        
        
        unStringContenido = fReprAsString( theContenidoUploadedFile)
        
        return unStringContenido
    def fReprAsString(self, theObject):
        """Representation of data structures as strings.
        
        """

        from Products.ModelDDvlPloneTool.ModelDDvlPloneToolSupport import fReprAsString
        return fReprAsString(theObject)
Example #3
0
    def fStringFromContenidoXML(self, theXMLSource):

        from Products.ModelDDvlPloneTool.ModelDDvlPloneToolSupport import fReprAsString

        unStringContenidoXML = fReprAsString(theXMLSource)

        return unStringContenidoXML
Example #4
0
    def fStringFromContenidoBinario(self, theContenidoBinario):

        from Products.ModelDDvlPloneTool.ModelDDvlPloneToolSupport import fReprAsString

        unStringContenidoBinario = fReprAsString(theContenidoBinario)

        return unStringContenidoBinario
def fgInitial_CacheConfigsHolder():
    from Products.ModelDDvlPloneTool.ModelDDvlPloneTool_Cache import ModelDDvlPloneTool_Cache as aModelDDvlPloneTool_Cache_Class
    aInitialCacheConfigs = aModelDDvlPloneTool_Cache_Class(
    ).fInitialCacheConfigs()

    from Products.ModelDDvlPloneTool.ModelDDvlPloneToolSupport import fReprAsString
    return fReprAsString(
        dict([[
            aCacheConfig.get('Name', ''),
            aCacheConfig,
        ] for aCacheConfig in aInitialCacheConfigs
              if aCacheConfig.get('Name', '')]))
Example #6
0
    def fElaborarInforme( self, 
        theUseCaseQueryResult       =None,
        theForceEllaboration        =False, 
        theCheckPermissions         =False, 
        thePermissionsCache         =None, 
        theRolesCache               =None, 
        theParentExecutionRecord    =None):
        """Generate the report by delegating in the TRACatalogo.
        
        """
        
       
        unExecutionRecord = self.fStartExecution( 'method',  'fElaborarInforme', theParentExecutionRecord, False) 
        
        from Products.ModelDDvlPloneTool.ModelDDvlPloneToolSupport import  fReprAsString, fDateTimeNow

        try:
            if ( not theForceEllaboration) and self.getHaComenzado():
                return False
            
            unPermissionsCache = fDictOrNew( thePermissionsCache)
            unRolesCache       = fDictOrNew( theRolesCache)
               
            
            if theCheckPermissions:
                if ( not theUseCaseQueryResult) or ( not theUseCaseQueryResult.get( 'success', False)) or not ( theUseCaseQueryResult.get( 'use_case_name', '') in [ cUseCase_EllaborateInformeModulesAndLanguages, cUseCase_CreateTRAInforme, ]):
                    
                    unUseCaseQueryResult = self.fUseCaseAssessment(  
                        theUseCaseName          = cUseCase_EllaborateInformeModulesAndLanguages,        
                        theElementsBindings     = { cBoundObject: self,},                                    
                        theRulesToCollect       = None,
                        thePermissionsCache     = unPermissionsCache,                                        
                        theRolesCache           = unRolesCache,                                              
                        theParentExecutionRecord= unExecutionRecord,                                          
                    )
                    if ( not unUseCaseQueryResult) or not unUseCaseQueryResult.get( 'success', False):
                        return False
                 
    
            unCatalogo = self.getCatalogo()
            if unCatalogo == None:
                self.setInformeExcepcion( "No containing Catalog found - possibly an instance of TRAInforme that has not been properly created")
                return False
    
     
            unMemberId = self.fGetMemberId()                
            unAhora    = fDateTimeNow()
            
            self.setHaComenzado( True)
            self.setEstadoProceso( 'Activo')
            self.setUsuarioInformador( unMemberId)
            self.setFechaComienzoProceso( unAhora)
            self.setHaCompletadoConExito( False)
            
            self.setInformeExcepcion( '')
            self.setInformeExcepcionIdiomas( '')
            self.setInformeExcepcionModulos( '')
             
            unInformeIdiomasEllaborated = False
            unInformeModulosEllaborated = False
                            
            try:

                unInformeIdiomas = unCatalogo.fElaborarInformeIdiomas( 
                    theCheckPermissions         =False, 
                    thePermissionsCache         =unPermissionsCache, 
                    theRolesCache               =unRolesCache, 
                    theParentExecutionRecord    =unExecutionRecord,
                )

                if not unInformeIdiomas:
                    unInformeExceptionIdiomas = "No Languages Report produced from Catalog - possibly an error in the reporting process."
                else:
                    unInformeExceptionIdiomas = unInformeIdiomas.get( 'exception', '')
                    
                if unInformeExceptionIdiomas:
                    self.setInformeExcepcionIdiomas( unInformeExceptionIdiomas)
                    self.setInformeExcepcion( "Exception during Languages Report Generation")
                     
                if unInformeIdiomas.get( 'success', False):
                    unInformeIdiomas[ 'report_date'] = self.fDateTimeToString( fDateTimeNow())
                    unInformeIdiomasString = ''
                    try:
                        unInformeIdiomasString = fReprAsString( unInformeIdiomas)
                    except:
                        None
                    if not unInformeIdiomasString:
                        self.setInformeExcepcionIdiomas( "Error converting Report to a String representation")
                        self.setInformeExcepcion( "Exception during Languages Report storage")
                        return False
                    
                    self.setInformeIdiomas( unInformeIdiomasString)
                    unInformeIdiomasEllaborated = True

                    
                    
                
                unInformeModulos = unCatalogo.fElaborarInformeModulos( 
                    theCheckPermissions         =False, 
                    thePermissionsCache         =unPermissionsCache, 
                    theRolesCache               =unRolesCache, 
                    theParentExecutionRecord    =unExecutionRecord,
                )

                if not unInformeModulos:
                    unInformeExceptionModulos = "No Modules Report produced from Catalog - possibly an error in the reporting process."
                else:
                    unInformeExceptionModulos = unInformeModulos.get( 'exception', '')

                if unInformeExceptionModulos:
                    self.setInformeExcepcionModulos( unInformeExceptionModulos)
                    self.setInformeExcepcion( "Exception during Modules Report Generation")
                     
                if unInformeModulos.get( 'success', False):
                    unInformeModulos[ 'report_date'] = self.fDateTimeToString( fDateTimeNow())
                    unInformeModulosString = ''
                    try:
                        unInformeModulosString = fReprAsString( unInformeModulos)
                    except:
                        None
                    if not unInformeModulosString:
                        self.setInformeExcepcionModulos( "Error converting Report to a String representation")
                        self.setInformeExcepcion( "Exception during Languages Report storage")
                        return False
              
                
                    self.setInformeModulos( unInformeModulosString)
                    unInformeModulosEllaborated = True
                
                    
                    
                self.setEstadoProceso( 'Inactivo')

                self.setFechaFinProceso( fDateTimeNow())
                
                self.pFlushCachedTemplates()
                
                unHaCompletadoConExito = unInformeIdiomasEllaborated and unInformeModulosEllaborated
                self.setHaCompletadoConExito( unHaCompletadoConExito)
                    
                return True
            
            except:
                unaExceptionInfo = sys.exc_info()
                unaExceptionFormattedTraceback = ''.join(traceback.format_exception( *unaExceptionInfo))
                
                unInformeExcepcion = 'Exception during fElaborarInforme\n' 
                unInformeExcepcion += 'exception class %s\n' % unaExceptionInfo[1].__class__.__name__ 
                try:
                    unInformeExcepcion += 'exception message %s\n\n' % str( unaExceptionInfo[1].args)
                except:
                    None
                unInformeExcepcion += unaExceptionFormattedTraceback   
                         
                   
                unExecutionRecord and unExecutionRecord.pRecordException( unInformeExcepcion)

                if cLogExceptions:
                    logging.getLogger( 'gvSIGi18n').error( unInformeExcepcion)
                
                return False

        
        finally:
            unExecutionRecord and unExecutionRecord.pEndExecution()