def test_getsize(self):
     f = open(test_support.TESTFN, "wb")
     try:
         f.write("foo")
         f.close()
         self.assertEqual(posixpath.getsize(test_support.TESTFN), 3)
     finally:
         if not f.closed:
             f.close()
예제 #2
0
 def test_getsize(self):
     f = open(test_support.TESTFN, "wb")
     try:
         f.write("foo")
         f.close()
         self.assertEqual(posixpath.getsize(test_support.TESTFN), 3)
     finally:
         if not f.closed:
             f.close()
         os.remove(test_support.TESTFN)
예제 #3
0
 def load(self, filepath):
     filepath = posixpath.expanduser(filepath)
     if not posixpath.isfile(filepath):
         raise PersistError("File not found: %s" % filepath)
     if posixpath.getsize(filepath) == 0:
         return
     try:
         self._hardmap = self._backend.load(filepath)
     except:
         filepathold = filepath+".old"
         if (posixpath.isfile(filepathold) and
             posixpath.getsize(filepathold) > 0):
             # warning("Broken configuration file at %s" % filepath)
             # warning("Trying backup at %s" % filepathold)
             try:
                 self._hardmap = self._backend.load(filepathold)
             except:
                 raise PersistError("Broken configuration file at %s" %
                                    filepathold)
         else:
             raise PersistError("Broken configuration file at %s" %
                                filepath)
예제 #4
0
 def load(self, filepath):
     filepath = posixpath.expanduser(filepath)
     if not posixpath.isfile(filepath):
         raise PersistError("File not found: %s" % filepath)
     if posixpath.getsize(filepath) == 0:
         return
     try:
         self._hardmap = self._backend.load(filepath)
     except:
         filepathold = filepath+".old"
         if (posixpath.isfile(filepathold) and
             posixpath.getsize(filepathold) > 0):
             # warning("Broken configuration file at %s" % filepath)
             # warning("Trying backup at %s" % filepathold)
             try:
                 self._hardmap = self._backend.load(filepathold)
             except:
                 raise PersistError("Broken configuration file at %s" %
                                    filepathold)
         else:
             raise PersistError("Broken configuration file at %s" %
                                filepath)
예제 #5
0
def scheduler_target_rgb_image(request, id=0):
    base = posixpath.join("/tmp/fweb/targets", str(id))

    try:
        os.makedirs(base)
    except:
        pass

    rgbname = posixpath.join(base, "rgb.jpg")

    if not posixpath.isfile(rgbname):
        # No cached file
        try:
            target = SchedulerTargets.objects.get(id=id)
            images = Images.objects.raw(
                "select *,get_filter_name(filter) as filter_string from images where keywords->'TARGET UUID'='%s' and q3c_radial_query(ra0, dec0, %s, %s, 2.0) order by channel_id"
                % (target.uuid, target.ra, target.dec))

            files_b, files_v, files_r = [], [], []

            for image in images:
                filename = posixpath.join(settings.BASE, image.filename)
                filename = fix_remote_path(filename, image.channel_id)

                if image.filter_string == 'B':
                    files_b.append(filename)
                if image.filter_string == 'V':
                    files_v.append(filename)
                if image.filter_string == 'R':
                    files_r.append(filename)

            if len(files_b) and len(files_v) and len(files_r):
                print files_b[0], files_v[0], files_r[0]
                coadd_rgb(name_blue=files_b[0],
                          name_green=files_v[0],
                          name_red=files_r[0],
                          out=rgbname)
        except:
            pass

    if not posixpath.isfile(rgbname):
        return HttpResponse("Can't create RGB image for target %s" % str(id))

    response = HttpResponse(FileWrapper(file(rgbname)),
                            content_type='image/jpeg')
    response['Content-Length'] = posixpath.getsize(rgbname)
    return response
예제 #6
0
    def summarize_media(self):
        """
        Write a summary of all the media in the database.
        """
        total_media = 0
        size_in_bytes = 0
        notfound = []
        
        self.doc.start_paragraph("SR-Heading")
        self.doc.write_text(self._("Media Objects"))
        self.doc.end_paragraph()
        
        total_media = len(self.__db.get_media_object_handles())
        mbytes = "0"
        for media_id in self.__db.get_media_object_handles():
            media = self.__db.get_object_from_handle(media_id)
            try:
                size_in_bytes += posixpath.getsize(
                                 media_path_full(self.__db, media.get_path()))
                length = len(str(size_in_bytes))
                if size_in_bytes <= 999999:
                    mbytes = self._("less than 1")
                else:
                    mbytes = str(size_in_bytes)[:(length-6)]
            except:
                notfound.append(media.get_path())
                
        self.doc.start_paragraph("SR-Normal")
        self.doc.write_text(self._("Number of unique media objects: %d") % 
                            total_media)
        self.doc.end_paragraph()
        
        self.doc.start_paragraph("SR-Normal")
        self.doc.write_text(self._("Total size of media objects: %s MB") % 
                            mbytes)
        self.doc.end_paragraph()
    
        if len(notfound) > 0:
            self.doc.start_paragraph("SR-Heading")
            self.doc.write_text(self._("Missing Media Objects"))
            self.doc.end_paragraph()

            for media_path in notfound:
                self.doc.start_paragraph("SR-Normal")
                self.doc.write_text(media_path)
                self.doc.end_paragraph()
예제 #7
0
파일: summary.py 프로젝트: cz172638/gramps
    def summarize_media(self):
        """
        Write a summary of all the media in the database.
        """
        total_media = 0
        size_in_bytes = 0
        notfound = []

        self.doc.start_paragraph("SR-Heading")
        self.doc.write_text(self._("Media Objects"))
        self.doc.end_paragraph()

        total_media = len(self.__db.get_media_handles())
        mbytes = "0"
        for media_id in self.__db.get_media_handles():
            media = self.__db.get_media_from_handle(media_id)
            try:
                size_in_bytes += posixpath.getsize(
                    media_path_full(self.__db, media.get_path()))
                length = len(str(size_in_bytes))
                if size_in_bytes <= 999999:
                    mbytes = self._("less than 1")
                else:
                    mbytes = str(size_in_bytes)[:(length-6)]
            except:
                notfound.append(media.get_path())

        self.doc.start_paragraph("SR-Normal")
        self.doc.write_text(self._("Number of unique media objects: %d"
                                  ) % total_media)
        self.doc.end_paragraph()

        self.doc.start_paragraph("SR-Normal")
        self.doc.write_text(self._("Total size of media objects: %s MB"
                                  ) % mbytes)
        self.doc.end_paragraph()

        if len(notfound) > 0:
            self.doc.start_paragraph("SR-Heading")
            self.doc.write_text(self._("Missing Media Objects"))
            self.doc.end_paragraph()

            for media_path in notfound:
                self.doc.start_paragraph("SR-Normal")
                self.doc.write_text(media_path)
                self.doc.end_paragraph()
예제 #8
0
    def download_proxy(self, filename):
        abs_filepath = posixpath.join(os.environ["DOCUMENT_ROOT"],
                                      cfg.base_path, filename)
        abs_filepath = posixpath.normpath(abs_filepath)

        abs_path, filename = posixpath.split(abs_filepath)

        self.check_absolute_path(abs_path)

        #~ print 'Content-Type: text/html\n\n<pre>' # Debug

        try:
            charset = self.get_charset(abs_filepath)
        except:
            charset = []

        #~ print 'Cache-Control: no-cache, must-revalidate'
        #~ print 'Pragma: no-cache'
        print 'Content-Length: %s' % posixpath.getsize(abs_filepath)
        print 'Content-Disposition: attachment; filename=%s' % filename
        print 'Content-Transfer-Encoding: binary'
        if charset != []:
            print 'Content-Type: text/plain; charset=%s\n' % charset
        else:
            print 'Content-Type: text/plain\n'

        f = file(abs_filepath, "rb")
        while True:
            # In Blöcken, die Datei rausprinten...
            data = f.read(8192)
            if not data:
                break
            sys.stdout.write(data)
        f.close()

        if cfg.use_sql_statistic == True:
            # Counter um eins erhöhen
            self.statistic.count(self.root_path, filename)

        sys.exit()
예제 #9
0
    def download_proxy( self, filename ):
        abs_filepath = posixpath.join( os.environ["DOCUMENT_ROOT"], cfg.base_path, filename )
        abs_filepath = posixpath.normpath( abs_filepath )

        abs_path, filename = posixpath.split( abs_filepath )

        self.check_absolute_path( abs_path )

        #~ print 'Content-Type: text/html\n\n<pre>' # Debug

        try:
            charset = self.get_charset( abs_filepath )
        except:
            charset = []

        #~ print 'Cache-Control: no-cache, must-revalidate'
        #~ print 'Pragma: no-cache'
        print 'Content-Length: %s' % posixpath.getsize( abs_filepath )
        print 'Content-Disposition: attachment; filename=%s' % filename
        print 'Content-Transfer-Encoding: binary'
        if charset != []:
            print 'Content-Type: text/plain; charset=%s\n' % charset
        else:
            print 'Content-Type: text/plain\n'

        f = file( abs_filepath, "rb" )
        while True:
            # In Blöcken, die Datei rausprinten...
            data = f.read(8192)
            if not data:
                break
            sys.stdout.write(data)
        f.close()

        if cfg.use_sql_statistic == True:
            # Counter um eins erhöhen
            self.statistic.count( self.root_path, filename )

        sys.exit()
예제 #10
0
    def main(self):
        self.set_text(_("Processing..."))
        database = self.dbstate.db

        total_media = 0
        males = 0
        females = 0
        unknowns = 0
        bytes = 0
        notfound = []

        mobjects = database.get_number_of_media()
        mbytes = "0"
        for media in database.iter_media():
            fullname = media_path_full(database, media.get_path())
            try:
                bytes += posixpath.getsize(fullname)
                length = len(str(bytes))
                if bytes <= 999999:
                    mbytes = _("less than 1")
                else:
                    mbytes = str(bytes)[:(length-6)]
            except OSError:
                notfound.append(media.get_path())

        if hasattr(database, 'genderStats'):
            males = sum([v[0] for v in database.genderStats.stats.values()])
            females = sum([v[1] for v in database.genderStats.stats.values()])
            unknowns = sum([v[2] for v in database.genderStats.stats.values()])

        self.clear_text()
        self.append_text(_("Individuals") + "\n")
        self.append_text("----------------------------\n")
        self.link(_("Number of individuals") + COLON,
                  'Filter', 'all people')
        self.append_text(" %s" % database.get_number_of_people())
        self.append_text("\n")
        self.link(_("%s:") % _("Males"), 'Filter', 'males')
        self.append_text(" %s" % males)
        self.append_text("\n")
        self.link(_("%s:") % _("Females"), 'Filter', 'females')
        self.append_text(" %s" % females)
        self.append_text("\n")
        self.link(_("%s:") % _("Individuals with unknown gender"),
                  'Filter', 'people with unknown gender')
        self.append_text(" %s" % unknowns)
        self.append_text("\n")
        self.append_text("\n%s\n" % _("Family Information"))
        self.append_text("----------------------------\n")
        self.link(_("%s:") % _("Number of families"),
                  'Filter', 'all families')
        self.append_text(" %s" % database.get_number_of_families())
        self.append_text("\n")
        if hasattr(database, 'surname_list'):
            self.link(_("%s:") % _("Unique surnames"),
                      'Filter', 'unique surnames')
            self.append_text(" %s" % len(set(database.surname_list)))
            self.append_text("\n")
        self.append_text("\n%s\n" % _("Media Objects"))
        self.append_text("----------------------------\n")
        self.link(_("%s:") % _("Total number of media object references"),
                  'Filter', 'media references')
        self.append_text(" %s" % total_media)
        self.append_text("\n")
        self.link(_("%s:") % _("Number of unique media objects"),
                  'Filter', 'unique media')
        self.append_text(" %s" % mobjects)
        self.append_text("\n")

        self.link(_("%s:") % _("Total size of media objects"),
                  'Filter', 'media by size')
        self.append_text(" %s %s" % (mbytes, _("Megabyte|MB")))
        self.append_text("\n")
        self.link(_("%s:") % _("Missing Media Objects"),
                  'Filter', 'missing media')
        self.append_text(" %s\n" % len(notfound))
        self.append_text("", scroll_to="begin")
예제 #11
0
    def main(self):
        self.set_text(_("Processing..."))
        database = self.dbstate.db

        total_media = 0
        males = 0
        females = 0
        unknowns = 0
        bytes = 0
        notfound = []

        mobjects = database.get_number_of_media()
        mbytes = "0"
        for media in database.iter_media():
            fullname = media_path_full(database, media.get_path())
            try:
                bytes += posixpath.getsize(fullname)
                length = len(str(bytes))
                if bytes <= 999999:
                    mbytes = _("less than 1")
                else:
                    mbytes = str(bytes)[:(length - 6)]
            except OSError:
                notfound.append(media.get_path())

        if hasattr(database, 'genderStats'):
            males = sum([v[0] for v in database.genderStats.stats.values()])
            females = sum([v[1] for v in database.genderStats.stats.values()])
            unknowns = sum([v[2] for v in database.genderStats.stats.values()])

        self.clear_text()
        self.append_text(_("Individuals") + "\n")
        self.append_text("----------------------------\n")
        self.link(_("Number of individuals") + COLON, 'Filter', 'all people')
        self.append_text(" %s" % database.get_number_of_people())
        self.append_text("\n")
        self.link(_("%s:") % _("Males"), 'Filter', 'males')
        self.append_text(" %s" % males)
        self.append_text("\n")
        self.link(_("%s:") % _("Females"), 'Filter', 'females')
        self.append_text(" %s" % females)
        self.append_text("\n")
        self.link(
            _("%s:") % _("Individuals with unknown gender"), 'Filter',
            'people with unknown gender')
        self.append_text(" %s" % unknowns)
        self.append_text("\n")
        self.append_text("\n%s\n" % _("Family Information"))
        self.append_text("----------------------------\n")
        self.link(_("%s:") % _("Number of families"), 'Filter', 'all families')
        self.append_text(" %s" % database.get_number_of_families())
        self.append_text("\n")
        if hasattr(database, 'surname_list'):
            self.link(
                _("%s:") % _("Unique surnames"), 'Filter', 'unique surnames')
            self.append_text(" %s" % len(set(database.surname_list)))
            self.append_text("\n")
        self.append_text("\n%s\n" % _("Media Objects"))
        self.append_text("----------------------------\n")
        self.link(
            _("%s:") % _("Total number of media object references"), 'Filter',
            'media references')
        self.append_text(" %s" % total_media)
        self.append_text("\n")
        self.link(
            _("%s:") % _("Number of unique media objects"), 'Filter',
            'unique media')
        self.append_text(" %s" % mobjects)
        self.append_text("\n")

        self.link(
            _("%s:") % _("Total size of media objects"), 'Filter',
            'media by size')
        self.append_text(" %s %s" % (mbytes, _("Megabyte|MB")))
        self.append_text("\n")
        self.link(
            _("%s:") % _("Missing Media Objects"), 'Filter', 'missing media')
        self.append_text(" %s\n" % len(notfound))
        self.append_text("", scroll_to="begin")
예제 #12
0
    def __init__(self, report, title, step):
        """
        @param: report        -- The instance of the main report class
                                 for this report
        @param: title         -- Is the title of the web page
        """
        import posixpath
        BasePage.__init__(self, report, title)
        self.bibli = Bibliography()
        self.uplink = False
        self.report = report
        # set the file name and open file
        output_file, sio = self.report.create_file("statistics")
        addressbookpage, head, body = self.write_header(_("Statistics"))
        (males, females,
         unknown) = self.get_gender(report.database.iter_person_handles())

        step()
        mobjects = report.database.get_number_of_media()
        npersons = report.database.get_number_of_people()
        nfamilies = report.database.get_number_of_families()
        nsurnames = len(set(report.database.surname_list))
        notfound = []
        total_media = 0
        mbytes = "0"
        chars = 0
        for media in report.database.iter_media():
            total_media += 1
            fullname = media_path_full(report.database, media.get_path())
            try:
                chars += posixpath.getsize(fullname)
                length = len(str(chars))
                if chars <= 999999:
                    mbytes = _("less than 1")
                else:
                    mbytes = str(chars)[:(length - 6)]
            except OSError:
                notfound.append(media.get_path())

        with Html("div", class_="content", id='EventDetail') as section:
            section += Html("h3", self._("Database overview"), inline=True)
        body += section
        with Html("div", class_="content", id='subsection narrative') as sec11:
            sec11 += Html("h4", self._("Individuals"), inline=True)
        body += sec11
        with Html("div", class_="content", id='subsection narrative') as sec1:
            sec1 += Html("br",
                         self._("Number of individuals") + self.colon +
                         "%d" % npersons,
                         inline=True)
            sec1 += Html("br",
                         self._("Males") + self.colon + "%d" % males,
                         inline=True)
            sec1 += Html("br",
                         self._("Females") + self.colon + "%d" % females,
                         inline=True)
            sec1 += Html("br",
                         self._("Individuals with unknown gender") +
                         self.colon + "%d" % unknown,
                         inline=True)
        body += sec1
        with Html("div", class_="content", id='subsection narrative') as sec2:
            sec2 += Html("h4", self._("Family Information"), inline=True)
            sec2 += Html("br",
                         self._("Number of families") + self.colon +
                         "%d" % nfamilies,
                         inline=True)
            sec2 += Html("br",
                         self._("Unique surnames") + self.colon +
                         "%d" % nsurnames,
                         inline=True)
        body += sec2
        with Html("div", class_="content", id='subsection narrative') as sec3:
            sec3 += Html("h4", self._("Media Objects"), inline=True)
            sec3 += Html("br",
                         self._("Total number of media object references") +
                         self.colon + "%d" % total_media,
                         inline=True)
            sec3 += Html("br",
                         self._("Number of unique media objects") +
                         self.colon + "%d" % mobjects,
                         inline=True)
            sec3 += Html("br",
                         self._("Total size of media objects") + self.colon +
                         "%8s %s" % (mbytes, self._("Megabyte|MB")),
                         inline=True)
            sec3 += Html("br",
                         self._("Missing Media Objects") + self.colon +
                         "%d" % len(notfound),
                         inline=True)
        body += sec3
        with Html("div", class_="content", id='subsection narrative') as sec4:
            sec4 += Html("h4", self._("Miscellaneous"), inline=True)
            sec4 += Html("br",
                         self._("Number of events") + self.colon +
                         "%d" % report.database.get_number_of_events(),
                         inline=True)
            sec4 += Html("br",
                         self._("Number of places") + self.colon +
                         "%d" % report.database.get_number_of_places(),
                         inline=True)
            nsources = report.database.get_number_of_sources()
            sec4 += Html("br",
                         self._("Number of sources") + self.colon +
                         "%d" % nsources,
                         inline=True)
            ncitations = report.database.get_number_of_citations()
            sec4 += Html("br",
                         self._("Number of citations") + self.colon +
                         "%d" % ncitations,
                         inline=True)
            nrepo = report.database.get_number_of_repositories()
            sec4 += Html("br",
                         self._("Number of repositories") + self.colon +
                         "%d" % nrepo,
                         inline=True)
        body += sec4

        (males, females,
         unknown) = self.get_gender(self.report.bkref_dict[Person].keys())

        origin = " :<br/>" + report.filter.get_name(self.rlocale)
        with Html("div", class_="content", id='EventDetail') as section:
            section += Html("h3",
                            self._("Narrative web content report for") +
                            origin,
                            inline=True)
        body += section
        with Html("div", class_="content", id='subsection narrative') as sec5:
            sec5 += Html("h4", self._("Individuals"), inline=True)
            sec5 += Html("br",
                         self._("Number of individuals") + self.colon +
                         "%d" % len(self.report.bkref_dict[Person]),
                         inline=True)
            sec5 += Html("br",
                         self._("Males") + self.colon + "%d" % males,
                         inline=True)
            sec5 += Html("br",
                         self._("Females") + self.colon + "%d" % females,
                         inline=True)
            sec5 += Html("br",
                         self._("Individuals with unknown gender") +
                         self.colon + "%d" % unknown,
                         inline=True)
        body += sec5
        with Html("div", class_="content", id='subsection narrative') as sec6:
            sec6 += Html("h4", self._("Family Information"), inline=True)
            sec6 += Html("br",
                         self._("Number of families") + self.colon +
                         "%d" % len(self.report.bkref_dict[Family]),
                         inline=True)
        body += sec6
        with Html("div", class_="content", id='subsection narrative') as sec7:
            sec7 += Html("h4", self._("Miscellaneous"), inline=True)
            sec7 += Html("br",
                         self._("Number of events") + self.colon +
                         "%d" % len(self.report.bkref_dict[Event]),
                         inline=True)
            sec7 += Html("br",
                         self._("Number of places") + self.colon +
                         "%d" % len(self.report.bkref_dict[Place]),
                         inline=True)
            sec7 += Html("br",
                         self._("Number of sources") + self.colon +
                         "%d" % len(self.report.bkref_dict[Source]),
                         inline=True)
            sec7 += Html("br",
                         self._("Number of citations") + self.colon +
                         "%d" % len(self.report.bkref_dict[Citation]),
                         inline=True)
            sec7 += Html("br",
                         self._("Number of repositories") + self.colon +
                         "%d" % len(self.report.bkref_dict[Repository]),
                         inline=True)
        body += sec7

        # add fullclear for proper styling
        # and footer section to page
        footer = self.write_footer(None)
        body += (FULLCLEAR, footer)

        # send page out for processing
        # and close the file
        self.xhtml_writer(addressbookpage, output_file, sio, 0)
예제 #13
0
    def main(self):
        self.set_text(_("Processing..."))
        database = self.dbstate.db
        personList = database.iter_people()

        with_media = 0
        total_media = 0
        incomp_names = 0
        disconnected = 0
        missing_bday = 0
        males = 0
        females = 0
        unknowns = 0
        bytes = 0
        namelist = []
        notfound = []

        mobjects = database.get_number_of_media_objects()
        mbytes = "0"
        for media in database.iter_media_objects():
            fullname = media_path_full(database, media.get_path())
            try:
                bytes += posixpath.getsize(fullname)
                length = len(str(bytes))
                if bytes <= 999999:
                    mbytes = _("less than 1")
                else:
                    mbytes = str(bytes)[:(length - 6)]
            except OSError:
                notfound.append(media.get_path())

        for cnt, person in enumerate(personList):
            length = len(person.get_media_list())
            if length > 0:
                with_media += 1
                total_media += length

            for name in [person.get_primary_name()
                         ] + person.get_alternate_names():

                # Count unique surnames
                if not name.get_surname().strip() in namelist \
                    and not name.get_surname().strip() == "":
                    namelist.append(name.get_surname().strip())

                if name.get_first_name().strip() == "":
                    incomp_names += 1
                else:
                    if name.get_surname_list():
                        for surname in name.get_surname_list():
                            if surname.get_surname().strip() == "":
                                incomp_names += 1
                    else:
                        incomp_names += 1

            if (not person.get_main_parents_family_handle()
                    and not len(person.get_family_handle_list())):
                disconnected += 1

            birth_ref = person.get_birth_ref()
            if birth_ref:
                birth = database.get_event_from_handle(birth_ref.ref)
                if not DateHandler.get_date(birth):
                    missing_bday += 1
            else:
                missing_bday += 1

            if person.get_gender() == gen.lib.Person.FEMALE:
                females += 1
            elif person.get_gender() == gen.lib.Person.MALE:
                males += 1
            else:
                unknowns += 1
            if not cnt % _YIELD_INTERVAL:
                yield True

        self.clear_text()
        self.append_text(_("Individuals") + "\n")
        self.append_text("----------------------------\n")
        self.link(_("Number of individuals") + ":", 'Filter', 'all people')
        self.append_text(" %s" % database.get_number_of_people())
        self.append_text("\n")
        self.link("%s:" % _("Males"), 'Filter', 'males')
        self.append_text(" %s" % males)
        self.append_text("\n")
        self.link("%s:" % _("Females"), 'Filter', 'females')
        self.append_text(" %s" % females)
        self.append_text("\n")
        self.link("%s:" % _("Individuals with unknown gender"), 'Filter',
                  'people with unknown gender')
        self.append_text(" %s" % unknowns)
        self.append_text("\n")
        self.link("%s:" % _("Individuals with incomplete names"), 'Filter',
                  'people with incomplete names')
        self.append_text(" %s" % incomp_names)
        self.append_text("\n")
        self.link("%s:" % _("Individuals missing birth dates"), 'Filter',
                  'people with missing birth dates')
        self.append_text(" %s" % missing_bday)
        self.append_text("\n")
        self.link("%s:" % _("Disconnected individuals"), 'Filter',
                  'disconnected people')
        self.append_text(" %s" % disconnected)
        self.append_text("\n")
        self.append_text("\n%s\n" % _("Family Information"))
        self.append_text("----------------------------\n")
        self.link("%s:" % _("Number of families"), 'Filter', 'all families')
        self.append_text(" %s" % database.get_number_of_families())
        self.append_text("\n")
        self.link("%s:" % _("Unique surnames"), 'Filter', 'unique surnames')
        self.append_text(" %s" % len(namelist))
        self.append_text("\n")
        self.append_text("\n%s\n" % _("Media Objects"))
        self.append_text("----------------------------\n")
        self.link("%s:" % _("Individuals with media objects"), 'Filter',
                  'people with media')
        self.append_text(" %s" % with_media)
        self.append_text("\n")
        self.link("%s:" % _("Total number of media object references"),
                  'Filter', 'media references')
        self.append_text(" %s" % total_media)
        self.append_text("\n")
        self.link("%s:" % _("Number of unique media objects"), 'Filter',
                  'unique media')
        self.append_text(" %s" % mobjects)
        self.append_text("\n")

        self.link("%s:" % _("Total size of media objects"), 'Filter',
                  'media by size')
        self.append_text(" %s %s" % (mbytes, _("Megabyte|MB")))
        self.append_text("\n")
        self.link("%s:" % _("Missing Media Objects"), 'Filter',
                  'missing media')
        self.append_text(" %s\n" % len(notfound))
        self.append_text("", scroll_to="begin")
예제 #14
0
    def main(self):
        self.set_text(_("Processing..."))
        database = self.dbstate.db
        personList = database.iter_people()

        with_media = 0
        total_media = 0
        incomp_names = 0
        disconnected = 0
        missing_bday = 0
        males = 0
        females = 0
        unknowns = 0
        bytes = 0
        namelist = []
        notfound = []

        mobjects = database.get_number_of_media()
        mbytes = "0"
        for media in database.iter_media():
            fullname = media_path_full(database, media.get_path())
            try:
                bytes += posixpath.getsize(fullname)
                length = len(str(bytes))
                if bytes <= 999999:
                    mbytes = _("less than 1")
                else:
                    mbytes = str(bytes)[:(length-6)]
            except OSError:
                notfound.append(media.get_path())

        for cnt, person in enumerate(personList):
            length = len(person.get_media_list())
            if length > 0:
                with_media += 1
                total_media += length

            for name in [person.get_primary_name()] + person.get_alternate_names():

            # Count unique surnames
                if not name.get_surname().strip() in namelist \
                    and not name.get_surname().strip() == "":
                    namelist.append(name.get_surname().strip())

                if name.get_first_name().strip() == "":
                    incomp_names += 1
                else:
                    if name.get_surname_list():
                        for surname in name.get_surname_list():
                            if surname.get_surname().strip() == "":
                                incomp_names += 1
                    else:
                        incomp_names += 1

            if (not person.get_main_parents_family_handle() and
                not len(person.get_family_handle_list())):
                disconnected += 1

            birth_ref = person.get_birth_ref()
            if birth_ref:
                birth = database.get_event_from_handle(birth_ref.ref)
                if not get_date(birth):
                    missing_bday += 1
            else:
                missing_bday += 1

            if person.get_gender() == Person.FEMALE:
                females += 1
            elif person.get_gender() == Person.MALE:
                males += 1
            else:
                unknowns += 1
            if not cnt % _YIELD_INTERVAL:
                yield True

        self.clear_text()
        self.append_text(_("Individuals") + "\n")
        self.append_text("----------------------------\n")
        self.link(_("Number of individuals") + ":",
                  'Filter', 'all people')
        self.append_text(" %s" % database.get_number_of_people())
        self.append_text("\n")
        self.link("%s:" % _("Males"), 'Filter', 'males')
        self.append_text(" %s" % males)
        self.append_text("\n")
        self.link("%s:" % _("Females"), 'Filter', 'females')
        self.append_text(" %s" % females)
        self.append_text("\n")
        self.link("%s:" % _("Individuals with unknown gender"),
                  'Filter', 'people with unknown gender')
        self.append_text(" %s" % unknowns)
        self.append_text("\n")
        self.link("%s:" % _("Incomplete names"),
                  'Filter', 'incomplete names')
        self.append_text(" %s" % incomp_names)
        self.append_text("\n")
        self.link("%s:" % _("Individuals missing birth dates"),
                  'Filter', 'people with missing birth dates')
        self.append_text(" %s" % missing_bday)
        self.append_text("\n")
        self.link("%s:" % _("Disconnected individuals"),
                  'Filter', 'disconnected people')
        self.append_text(" %s" % disconnected)
        self.append_text("\n")
        self.append_text("\n%s\n" % _("Family Information"))
        self.append_text("----------------------------\n")
        self.link("%s:" % _("Number of families"),
                  'Filter', 'all families')
        self.append_text(" %s" % database.get_number_of_families())
        self.append_text("\n")
        self.link("%s:" % _("Unique surnames"),
                  'Filter', 'unique surnames')
        self.append_text(" %s" % len(namelist))
        self.append_text("\n")
        self.append_text("\n%s\n" % _("Media Objects"))
        self.append_text("----------------------------\n")
        self.link("%s:" % _("Individuals with media objects"),
                  'Filter', 'people with media')
        self.append_text(" %s" % with_media)
        self.append_text("\n")
        self.link("%s:" % _("Total number of media object references"),
                  'Filter', 'media references')
        self.append_text(" %s" % total_media)
        self.append_text("\n")
        self.link("%s:" % _("Number of unique media objects"),
                  'Filter', 'unique media')
        self.append_text(" %s" % mobjects)
        self.append_text("\n")

        self.link("%s:" % _("Total size of media objects"),
                  'Filter', 'media by size')
        self.append_text(" %s %s" % (mbytes, _("Megabyte|MB")))
        self.append_text("\n")
        self.link("%s:" % _("Missing Media Objects"),
                  'Filter', 'missing media')
        self.append_text(" %s\n" % len(notfound))
        self.append_text("", scroll_to="begin")
예제 #15
0
def run(database, document, filter_name, *args, **kwargs):
    """
    Loops through the families that the person is a child in, and display
    the information about the other children.
    """
    # setup the simple access functions
    sdb = SimpleAccess(database)
    sdoc = SimpleDoc(document)
    stab = QuickTable(sdb)
    if (filter_name == 'all'):
        sdoc.title(_("Summary counts of current selection"))
        sdoc.paragraph("")
        sdoc.paragraph(_("Right-click row (or press ENTER) to see selected items."))
        sdoc.paragraph("")
        stab.columns(_("Object"), _("Count/Total"))
        if hasattr(database, "db"):
            stab.row([_("People"), "Filter", "Person"], 
                     "%d/%d" % (len(database.get_person_handles()),
                                len(database.db.get_person_handles())))
            stab.row([_("Families"), "Filter", "Family"], 
                     "%d/%d" % (len(database.get_family_handles()),
                                len(database.db.get_family_handles())))
            stab.row([_("Events"), "Filter", "Event"], 
                     "%d/%d" % (len(database.get_event_handles()),
                                len(database.db.get_event_handles())))
            stab.row([_("Places"), "Filter", "Place"], 
                     "%d/%d" % (len(database.get_place_handles()),
                                len(database.db.get_place_handles())))
            stab.row([_("Sources"), "Filter", "Source"], 
                     "%d/%d" % (len(database.get_source_handles()),
                                len(database.db.get_source_handles())))
            stab.row([_("Repositories"), "Filter", "Repository"], 
                     "%d/%d" % (len(database.get_repository_handles()),
                     len(database.db.get_repository_handles())))
            stab.row([_("Media"), "Filter", "MediaObject"], 
                     "%d/%d" % (len(database.get_media_object_handles()),
                                len(database.db.get_media_object_handles())))
            stab.row([_("Notes"), "Filter", "Note"], 
                     "%d/%d" % (len(database.get_note_handles()),
                                len(database.db.get_note_handles())))
        else:
            stab.row([_("People"), "Filter", "Person"], 
                     "%d/%d" % (len(database.get_person_handles()),
                                len(database.basedb.get_person_handles())))
            stab.row([_("Families"), "Filter", "Family"], 
                     "%d/%d" % (len(database.get_family_handles()),
                                len(database.basedb.get_family_handles())))
            stab.row([_("Events"), "Filter", "Event"], 
                     "%d/%d" % (len(database.get_event_handles()),
                                len(database.basedb.get_event_handles())))
            stab.row([_("Places"), "Filter", "Place"], 
                     "%d/%d" % (len(database.get_place_handles()),
                                len(database.basedb.get_place_handles())))
            stab.row([_("Sources"), "Filter", "Source"], 
                     "%d/%d" % (len(database.get_source_handles()),
                                len(database.basedb.get_source_handles())))
            stab.row([_("Repositories"), "Filter", "Repository"], 
                     "%d/%d" % (len(database.get_repository_handles()),
                     len(database.basedb.get_repository_handles())))
            stab.row([_("Media"), "Filter", "MediaObject"], 
                     "%d/%d" % (len(database.get_media_object_handles()),
                                len(database.basedb.get_media_object_handles())))
            stab.row([_("Notes"), "Filter", "Note"], 
                     "%d/%d" % (len(database.get_note_handles()),
                                len(database.basedb.get_note_handles())))
        sdoc.paragraph("")
        stab.write(sdoc)
        return

    # display the title
    if filter_name in fname_map:
        sdoc.title(_("Filtering on %s") % fname_map[filter_name]) # listed above
    else:
        sdoc.title(_("Filtering on %s") % _(filter_name))
    sdoc.paragraph("")
    matches = 0

    if (filter_name == 'Inverse Person'):
        sdb.dbase = database.db
        stab.columns(_("Person"), _("Gramps ID"), _("Birth Date"))
        proxy_handles = set(database.iter_person_handles())

        for person in database.db.iter_people():
            if person.handle not in proxy_handles:
                stab.row(person, person.gramps_id, 
                         sdb.birth_or_fallback(person))
                matches += 1

    elif (filter_name == 'Inverse Family'):
        sdb.dbase = database.db
        stab.columns(_("Family"), _("Gramps ID"))
        proxy_handles = set(database.iter_family_handles())

        for family in database.db.iter_families():
            if family.handle not in proxy_handles:
                stab.row(family, family.gramps_id)
                matches += 1

    elif (filter_name == 'Inverse Event'):
        sdb.dbase = database.db
        stab.columns(_("Event"), _("Gramps ID"))
        proxy_handles = set(database.iter_event_handles())

        for event in database.db.iter_events():
            if event.handle not in proxy_handles:
                stab.row(event, event.gramps_id)
                matches += 1

    elif (filter_name == 'Inverse Place'):
        sdb.dbase = database.db
        stab.columns(_("Place"), _("Gramps ID"))
        proxy_handles = set(database.iter_place_handles())                              

        for place in database.db.iter_places():
            if place.handle not in proxy_handles:
                stab.row(place, place.gramps_id)
                matches += 1

    elif (filter_name == 'Inverse Source'):
        sdb.dbase = database.db
        stab.columns(_("Source"), _("Gramps ID"))
        proxy_handles = set(database.iter_source_handles())                              

        for source in database.db.iter_sources():
            if source.handle not in proxy_handles:
                stab.row(source, source.gramps_id)
                matches += 1

    elif (filter_name == 'Inverse Repository'):
        sdb.dbase = database.db
        stab.columns(_("Repository"), _("Gramps ID"))
        proxy_handles = set(database.iter_repository_handles())

        for repository in database.db.iter_repositories():
            if repository.handle not in proxy_handles:
                stab.row(repository, repository.gramps_id)
                matches += 1

    elif (filter_name == 'Inverse MediaObject'):
        sdb.dbase = database.db
        stab.columns(_("Media"), _("Gramps ID"))
        proxy_handles = set(database.iter_media_object_handles())                              

        for media in database.db.iter_media_objects():
            if media.handle not in proxy_handles:
                stab.row(media, media.gramps_id)
                matches += 1

    elif (filter_name == 'Inverse Note'):
        sdb.dbase = database.db
        stab.columns(_("Note"), _("Gramps ID"))
        proxy_handles = set(database.iter_note_handles())                              

        for note in database.db.iter_notes():
            if note.handle not in proxy_handles:
                stab.row(note, note.gramps_id)
                matches += 1

    elif (filter_name in ['all people', 'Person']):
        stab.columns(_("Person"), _("Gramps ID"), _("Birth Date"))
        for person in database.iter_people():
            stab.row(person, person.gramps_id, sdb.birth_or_fallback(person))
            matches += 1

    elif (filter_name in ['all families', 'Family']):
        stab.columns(_("Family"), _("Gramps ID"))
        for family in database.iter_families():
            stab.row(family, family.gramps_id)
            matches += 1

    elif (filter_name in ['all events', 'Event']):
        stab.columns(_("Event"), _("Gramps ID"))
        for obj in database.iter_events():
            stab.row(obj, obj.gramps_id)
            matches += 1

    elif (filter_name in ['all places', 'Place']):
        stab.columns(_("Place"), _("Gramps ID"))
        for obj in database.iter_places():
            stab.row(obj, obj.gramps_id)
            matches += 1

    elif (filter_name in ['all sources', 'Source']):
        stab.columns(_("Source"), _("Gramps ID"))
        for obj in database.iter_sources():
            stab.row(obj, obj.gramps_id)
            matches += 1

    elif (filter_name in ['all repositories', 'Repository']):
        stab.columns(_("Repository"), _("Gramps ID"))
        for obj in database.iter_repositories():
            stab.row(obj, obj.gramps_id)
            matches += 1

    elif (filter_name in ['all media', 'MediaObject']):
        stab.columns(_("Media"), _("Gramps ID"))
        for obj in database.iter_media_objects():
            stab.row(obj, obj.gramps_id)
            matches += 1

    elif (filter_name in ['all notes', 'Note']):
        stab.columns(_("Note"), _("Gramps ID"))
        for obj in database.iter_notes():
            stab.row(obj, obj.gramps_id)
            matches += 1

    elif (filter_name == 'males'):
        stab.columns(_("Person"), _("Birth Date"), _("Name type"))
        for person in database.iter_people():
            if person.gender == Person.MALE:
                stab.row(person, sdb.birth_or_fallback(person),
                         str(person.get_primary_name().get_type()))
                matches += 1

    elif (filter_name == 'females'):
        stab.columns(_("Person"), _("Birth Date"), _("Name type"))
        for person in database.iter_people():
            if person.gender == Person.FEMALE:
                stab.row(person, sdb.birth_or_fallback(person),
                         str(person.get_primary_name().get_type()))
                matches += 1

    elif (filter_name == 'people with unknown gender'):
        stab.columns(_("Person"), _("Birth Date"), _("Name type"))
        for person in database.iter_people():
            if person.gender not in [Person.FEMALE, Person.MALE]:
                stab.row(person, sdb.birth_or_fallback(person),
                         str(person.get_primary_name().get_type()))
                matches += 1

    elif (filter_name == 'incomplete names'):
        stab.columns(_("Name"), _("Birth Date"), _("Name type"))
        for person in database.iter_people():
            for name in [person.get_primary_name()] + person.get_alternate_names():
                if name.get_first_name().strip() == "":
                    stab.row([name.get_name(), "Person", person.handle], sdb.birth_or_fallback(person),
                             str(name.get_type()))
                    matches += 1
                else:
                    if name.get_surname_list():
                        for surname in name.get_surname_list():
                            if surname.get_surname().strip() == "":
                                stab.row([name.get_first_name(), "Person", person.handle], sdb.birth_or_fallback(person),
                                         str(name.get_type()))
                                matches += 1
                    else:
                        stab.row([name.get_first_name(), "Person", person.handle], sdb.birth_or_fallback(person),
                                 str(name.get_type()))
                        matches += 1

    elif (filter_name == 'people with missing birth dates'):
        stab.columns(_("Person"), _("Type"))
        for person in database.iter_people():
            birth_ref = person.get_birth_ref()
            if birth_ref:
                birth = database.get_event_from_handle(birth_ref.ref)
                if not get_date(birth):
                    stab.row(person, _("birth event but no date"))
                    matches += 1
            else:
                stab.row(person, _("missing birth event"))
                matches += 1

    elif (filter_name == 'disconnected people'):
        stab.columns(_("Person"), _("Birth Date"), _("Name type"))
        for person in database.iter_people():
            if ((not person.get_main_parents_family_handle()) and 
                (not len(person.get_family_handle_list()))):
                stab.row(person, sdb.birth_or_fallback(person),
                         str(person.get_primary_name().get_type()))
                matches += 1

    elif (filter_name == 'unique surnames'):
        namelist = defaultdict(int)
        for person in database.iter_people():
            names = [person.get_primary_name()] + person.get_alternate_names()
            surnames = list(set([name.get_group_name() for name in names]))
            for surname in surnames:
                namelist[surname] += 1
        stab.columns(_("Surname"), _("Count"))
        for name in sorted(namelist):
            stab.row(name, namelist[name])
            matches += 1
        stab.set_callback("leftdouble", 
            lambda name: run_quick_report_by_name_direct("samesurnames",
                                                         database,
                                                         document,
                                                         name))

    elif (filter_name == 'people with media'):
        stab.columns(_("Person"), _("Media count"))
        for person in database.iter_people():
            length = len(person.get_media_list())
            if length > 0:
                stab.row(person, str(length))
                matches += 1

    elif (filter_name == 'media references'):
        stab.columns(_("Person"), _("Reference"))
        for person in database.iter_people():
            medialist = person.get_media_list()
            for item in medialist:
                stab.row(person, _("media"))
                matches += 1

    elif (filter_name == 'unique media'):
        stab.columns(_("Unique Media"))
        for photo in database.iter_media_objects():
            fullname = media_path_full(database, photo.get_path())
            stab.row(fullname)
            matches += 1

    elif (filter_name == 'missing media'):
        stab.columns(_("Missing Media"))
        for photo in database.iter_media_objects():
            fullname = media_path_full(database, photo.get_path())
            try:
                posixpath.getsize(fullname)
            except:
                stab.row(fullname)
                matches += 1

    elif (filter_name == 'media by size'):
        stab.columns(_("Media"), _("Size in bytes"))
        for photo in database.iter_media_objects():
            fullname = media_path_full(database, photo.get_path())
            try:
                bytes = posixpath.getsize(fullname)
                stab.row(fullname, str(bytes))
                matches += 1
            except:
                pass

    elif (filter_name == 'list of people'):
        stab.columns(_("Person"), _("Birth Date"), _("Name type"))
        handles = kwargs["handles"]
        for person_handle in handles:
            person = database.get_person_from_handle(person_handle)
            stab.row(person, sdb.birth_or_fallback(person),
                     str(person.get_primary_name().get_type()))
            matches += 1

    else:
        raise AttributeError("invalid filter name: '%s'" % filter_name)
    # translators: leave all/any {...} untranslated
    sdoc.paragraph(ngettext("Filter matched {number_of} record.",
                            "Filter matched {number_of} records.", matches
                           ).format(number_of=matches) )
    sdoc.paragraph("")
    document.has_data = matches > 0
    if matches > 0:
        stab.write(sdoc)
예제 #16
0
    def __init__(self, report, title, step):
        """
        @param: report        -- The instance of the main report class
                                 for this report
        @param: title         -- Is the title of the web page
        """
        import posixpath
        BasePage.__init__(self, report, title)
        self.bibli = Bibliography()
        self.uplink = False
        self.report = report
        # set the file name and open file
        output_file, sio = self.report.create_file("statistics")
        addressbookpage, head, body = self.write_header(_("Statistics"))
        (males,
         females,
         unknown) = self.get_gender(report.database.iter_person_handles())

        step()
        mobjects = report.database.get_number_of_media()
        npersons = report.database.get_number_of_people()
        nfamilies = report.database.get_number_of_families()
        nsurnames = len(set(report.database.surname_list))
        notfound = []
        total_media = 0
        mbytes = "0"
        chars = 0
        for media in report.database.iter_media():
            total_media += 1
            fullname = media_path_full(report.database, media.get_path())
            try:
                chars += posixpath.getsize(fullname)
                length = len(str(chars))
                if chars <= 999999:
                    mbytes = _("less than 1")
                else:
                    mbytes = str(chars)[:(length-6)]
            except OSError:
                notfound.append(media.get_path())


        with Html("div", class_="content", id='EventDetail') as section:
            section += Html("h3", self._("Database overview"), inline=True)
        body += section
        with Html("div", class_="content", id='subsection narrative') as sec11:
            sec11 += Html("h4", self._("Individuals"), inline=True)
        body += sec11
        with Html("div", class_="content", id='subsection narrative') as sec1:
            sec1 += Html("br", self._("Number of individuals") + self.colon +
                         "%d" % npersons, inline=True)
            sec1 += Html("br", self._("Males") + self.colon +
                         "%d" % males, inline=True)
            sec1 += Html("br", self._("Females") + self.colon +
                         "%d" % females, inline=True)
            sec1 += Html("br", self._("Individuals with unknown gender") +
                         self.colon + "%d" % unknown, inline=True)
        body += sec1
        with Html("div", class_="content", id='subsection narrative') as sec2:
            sec2 += Html("h4", self._("Family Information"), inline=True)
            sec2 += Html("br", self._("Number of families") + self.colon +
                         "%d" % nfamilies, inline=True)
            sec2 += Html("br", self._("Unique surnames") + self.colon +
                         "%d" % nsurnames, inline=True)
        body += sec2
        with Html("div", class_="content", id='subsection narrative') as sec3:
            sec3 += Html("h4", self._("Media Objects"), inline=True)
            sec3 += Html("br",
                         self._("Total number of media object references") +
                         self.colon + "%d" % total_media, inline=True)
            sec3 += Html("br", self._("Number of unique media objects") +
                         self.colon + "%d" % mobjects, inline=True)
            sec3 += Html("br", self._("Total size of media objects") +
                         self.colon +
                         "%8s %s" % (mbytes, self._("Megabyte|MB")),
                         inline=True)
            sec3 += Html("br", self._("Missing Media Objects") +
                         self.colon + "%d" % len(notfound), inline=True)
        body += sec3
        with Html("div", class_="content", id='subsection narrative') as sec4:
            sec4 += Html("h4", self._("Miscellaneous"), inline=True)
            sec4 += Html("br", self._("Number of events") + self.colon +
                         "%d" % report.database.get_number_of_events(),
                         inline=True)
            sec4 += Html("br", self._("Number of places") + self.colon +
                         "%d" % report.database.get_number_of_places(),
                         inline=True)
            nsources = report.database.get_number_of_sources()
            sec4 += Html("br", self._("Number of sources") +
                         self.colon + "%d" % nsources,
                         inline=True)
            ncitations = report.database.get_number_of_citations()
            sec4 += Html("br", self._("Number of citations") +
                         self.colon + "%d" % ncitations,
                         inline=True)
            nrepo = report.database.get_number_of_repositories()
            sec4 += Html("br", self._("Number of repositories") +
                         self.colon + "%d" % nrepo,
                         inline=True)
        body += sec4

        (males,
         females,
         unknown) = self.get_gender(self.report.bkref_dict[Person].keys())

        origin = " :<br/>" + report.filter.get_name(self.rlocale)
        with Html("div", class_="content", id='EventDetail') as section:
            section += Html("h3",
                            self._("Narrative web content report for") + origin,
                            inline=True)
        body += section
        with Html("div", class_="content", id='subsection narrative') as sec5:
            sec5 += Html("h4", self._("Individuals"), inline=True)
            sec5 += Html("br", self._("Number of individuals") + self.colon +
                         "%d" % len(self.report.bkref_dict[Person]),
                         inline=True)
            sec5 += Html("br", self._("Males") + self.colon +
                         "%d" % males, inline=True)
            sec5 += Html("br", self._("Females") + self.colon +
                         "%d" % females, inline=True)
            sec5 += Html("br", self._("Individuals with unknown gender") +
                         self.colon + "%d" % unknown, inline=True)
        body += sec5
        with Html("div", class_="content", id='subsection narrative') as sec6:
            sec6 += Html("h4", self._("Family Information"), inline=True)
            sec6 += Html("br", self._("Number of families") + self.colon +
                         "%d" % len(self.report.bkref_dict[Family]),
                         inline=True)
        body += sec6
        with Html("div", class_="content", id='subsection narrative') as sec7:
            sec7 += Html("h4", self._("Miscellaneous"), inline=True)
            sec7 += Html("br", self._("Number of events") + self.colon +
                         "%d" % len(self.report.bkref_dict[Event]),
                         inline=True)
            sec7 += Html("br", self._("Number of places") + self.colon +
                         "%d" % len(self.report.bkref_dict[Place]),
                         inline=True)
            sec7 += Html("br", self._("Number of sources") + self.colon +
                         "%d" % len(self.report.bkref_dict[Source]),
                         inline=True)
            sec7 += Html("br", self._("Number of citations") + self.colon +
                         "%d" % len(self.report.bkref_dict[Citation]),
                         inline=True)
            sec7 += Html("br", self._("Number of repositories") + self.colon +
                         "%d" % len(self.report.bkref_dict[Repository]),
                         inline=True)
        body += sec7

        # add fullclear for proper styling
        # and footer section to page
        footer = self.write_footer(None)
        body += (FULLCLEAR, footer)

        # send page out for processing
        # and close the file
        self.xhtml_writer(addressbookpage, output_file, sio, 0)
예제 #17
0
 def update_event(self, inp=-1):
     self.set_output_val(0, posixpath.getsize(self.input(0)))