Ejemplo n.º 1
0
class TxtIndex(indexer):
    def _getMimeTypes(self):
        return [
            'text/plain', 'text/html', 'text/diff', 'text/xml', 'text/*',
            'application/xml'
        ]

    def _getExtensions(self):
        return ['.txt', '.py']

    def _doIndexContent(self, content):
        return content


cntIndex.register(TxtIndex())


class PptxIndex(indexer):
    def _getMimeTypes(self):
        return [
            'application/vnd.openxmlformats-officedocument.presentationml.presentation'
        ]

    def _getExtensions(self):
        return ['.pptx']

    def _doIndexFile(self, fname):
        def toString():
            """ Converts the document to a string. """
            buffer = u""
Ejemplo n.º 2
0
        elif node.nodeType == xml.dom.Node.ELEMENT_NODE :
            buffer += textToString(node)
    return buffer
        
class TxtIndex(indexer):
    def _getMimeTypes(self):
        return ['text/plain','text/html','text/diff','text/xml', 'text/*', 
            'application/xml']
    
    def _getExtensions(self):
        return ['.txt', '.py']

    def _doIndexContent(self, content):
        return content

cntIndex.register(TxtIndex())

class PptxIndex(indexer):
    def _getMimeTypes(self):
        return [ 'application/vnd.openxmlformats-officedocument.presentationml.presentation']
    
    def _getExtensions(self):
        return ['.pptx']

    def _doIndexFile(self, fname):
        def toString () :
            """ Converts the document to a string. """
            buffer = u""
            for val in ["a:t"]:
                for paragraph in content.getElementsByTagName(val) :
                    buffer += textToString(paragraph) + "\n"