2008-01-15 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/GrampsDbUtils/_GrampsDbWriteXML.py * src/GrampsDbUtils/_WriteGedcom.py * src/plugins/ExportCSV.py * src/plugins/ExportVCalendar.py * src/plugins/ExportVCard.py * src/plugins/WriteCD.py * src/plugins/WriteFtree.py * src/plugins/WriteGeneWeb.py * src/plugins/WritePkg.py * src/PluginUtils/_PluginMgr.py: pylint fixes pylint fixes and work on 0001597 svn: r9812
This commit is contained in:
parent
ae138d2d01
commit
2225ac3d78
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2008-01-15 Raphael Ackermann <raphael.ackermann@gmail.com>
|
||||
* src/GrampsDbUtils/_GrampsDbWriteXML.py
|
||||
* src/GrampsDbUtils/_WriteGedcom.py
|
||||
* src/plugins/ExportCSV.py
|
||||
* src/plugins/ExportVCalendar.py
|
||||
* src/plugins/ExportVCard.py
|
||||
* src/plugins/WriteCD.py
|
||||
* src/plugins/WriteFtree.py
|
||||
* src/plugins/WriteGeneWeb.py
|
||||
* src/plugins/WritePkg.py
|
||||
* src/PluginUtils/_PluginMgr.py: pylint fixes
|
||||
pylint fixes and work on 0001597
|
||||
|
||||
2008-01-14 Raphael Ackermann <raphael.ackermann@gmail.com>
|
||||
* src/DbLoader.py: typo
|
||||
* src/plugins/ImportCSV.py: register text/csv as another mime type for csv
|
||||
|
@ -54,12 +54,12 @@ log = logging.getLogger(".WriteXML")
|
||||
import gen.lib
|
||||
from BasicUtils import UpdateCallback
|
||||
|
||||
from gen.db.dbconst import \
|
||||
PERSON_KEY,FAMILY_KEY,SOURCE_KEY,EVENT_KEY,\
|
||||
MEDIA_KEY,PLACE_KEY,REPOSITORY_KEY,NOTE_KEY
|
||||
|
||||
from gen.db.exceptions import *
|
||||
from gen.utils.longop import LongOpStatus
|
||||
#from gen.db.dbconst import \
|
||||
# PERSON_KEY,FAMILY_KEY,SOURCE_KEY,EVENT_KEY,\
|
||||
# MEDIA_KEY,PLACE_KEY,REPOSITORY_KEY,NOTE_KEY
|
||||
#
|
||||
from gen.db.exceptions import GrampsDbWriteFailure
|
||||
#from gen.utils.longop import LongOpStatus
|
||||
|
||||
import gen.proxy
|
||||
|
||||
@ -91,7 +91,6 @@ def escxml(d):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def exportData(database, filename, person, option_box, callback, version="unknown"):
|
||||
ret = 0
|
||||
if os.path.isfile(filename):
|
||||
try:
|
||||
shutil.copyfile(filename, filename + ".bak")
|
||||
@ -117,8 +116,7 @@ def exportData(database, filename, person, option_box, callback, version="unknow
|
||||
database = gen.proxy.FilterProxyDb(database, option_box.cfilter)
|
||||
|
||||
g = GrampsDbXmlWriter(database, 0, compress, version, callback)
|
||||
ret = g.write(filename)
|
||||
return ret
|
||||
return g.write(filename)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -1001,8 +999,8 @@ class GrampsDbXmlWriter(UpdateCallback):
|
||||
(sp,corner1_x,corner1_y,corner2_x,corner2_y))
|
||||
self.write_attribute_list(proplist,indent+1)
|
||||
for ref in refslist:
|
||||
self.dump_source_ref(ref,indent+1)
|
||||
self.write_note_list(nreflist,indent+1)
|
||||
self.dump_source_ref(ref, indent+1)
|
||||
self.write_note_list(nreflist, indent+1)
|
||||
self.g.write('%s</objref>\n' % sp)
|
||||
|
||||
def write_data_map(self,datamap,indent=3):
|
||||
@ -1012,9 +1010,9 @@ class GrampsDbXmlWriter(UpdateCallback):
|
||||
sp = ' '*indent
|
||||
for key in datamap.keys():
|
||||
self.g.write('%s<data_item key="%s" value="%s"/>\n' %
|
||||
(sp,self.fix(key),self.fix(datamap[key])))
|
||||
(sp,self.fix(key), self.fix(datamap[key])))
|
||||
|
||||
def write_reporef_list(self,rrlist,index=1):
|
||||
def write_reporef_list(self, rrlist, index=1):
|
||||
for reporef in rrlist:
|
||||
if not reporef or not reporef.ref:
|
||||
continue
|
||||
@ -1037,16 +1035,16 @@ class GrampsDbXmlWriter(UpdateCallback):
|
||||
|
||||
note_list = reporef.get_note_list()
|
||||
if len(note_list) == 0:
|
||||
self.write_ref('reporef',reporef.ref,index,close=True,
|
||||
self.write_ref('reporef', reporef.ref, index, close=True,
|
||||
extra_text=priv_text+callno_text+type_text)
|
||||
else:
|
||||
self.write_ref('reporef',reporef.ref,index,close=False,
|
||||
self.write_ref('reporef', reporef.ref, index, close=False,
|
||||
extra_text=priv_text+callno_text+type_text)
|
||||
self.write_note_list(note_list,index+1)
|
||||
self.write_note_list(note_list, index+1)
|
||||
sp = " "*index
|
||||
self.g.write('%s</reporef>\n' % sp)
|
||||
|
||||
def write_url_list(self,list,index=1):
|
||||
def write_url_list(self, list, index=1):
|
||||
sp = " "*index
|
||||
for url in list:
|
||||
url_type = url.get_type().xml_str()
|
||||
@ -1062,10 +1060,10 @@ class GrampsDbXmlWriter(UpdateCallback):
|
||||
desc_text = ''
|
||||
path_text = ' href="%s"' % self.fix(url.get_path())
|
||||
self.g.write('%s<url%s%s%s%s/>\n' % \
|
||||
(sp,priv_text,path_text,type_text,desc_text))
|
||||
(sp, priv_text, path_text, type_text, desc_text))
|
||||
|
||||
def write_place_obj(self,place,index=1):
|
||||
self.write_primary_tag("placeobj",place,index)
|
||||
def write_place_obj(self, place, index=1):
|
||||
self.write_primary_tag("placeobj", place, index)
|
||||
|
||||
title = self.fix(place.get_title())
|
||||
longitude = self.fix(place.get_longitude())
|
||||
@ -1081,23 +1079,23 @@ class GrampsDbXmlWriter(UpdateCallback):
|
||||
|
||||
if title == "":
|
||||
title = self.build_place_title(place.get_main_location())
|
||||
self.write_line_nofix("ptitle",title,index+1)
|
||||
self.write_line_nofix("ptitle", title, index+1)
|
||||
|
||||
if longitude or lat:
|
||||
self.g.write('%s<coord long="%s" lat="%s"/>\n'
|
||||
% (" "*(index+1),longitude,lat))
|
||||
% (" "*(index+1), longitude, lat))
|
||||
self.dump_location(main_loc)
|
||||
for loc in place.get_alternate_locations():
|
||||
self.dump_location(loc)
|
||||
self.write_media_list(place.get_media_list(),index+1)
|
||||
self.write_media_list(place.get_media_list(), index+1)
|
||||
self.write_url_list(place.get_url_list())
|
||||
self.write_note_list(place.get_note_list(),index+1)
|
||||
self.write_note_list(place.get_note_list(), index+1)
|
||||
for s in place.get_source_references():
|
||||
self.dump_source_ref(s,index+1)
|
||||
self.dump_source_ref(s, index+1)
|
||||
self.g.write("%s</placeobj>\n" % (" "*index))
|
||||
|
||||
def write_object(self,obj,index=1):
|
||||
self.write_primary_tag("object",obj,index)
|
||||
def write_object(self, obj, index=1):
|
||||
self.write_primary_tag("object", obj, index)
|
||||
handle = obj.get_gramps_id()
|
||||
mime_type = obj.get_mime_type()
|
||||
path = obj.get_path()
|
||||
@ -1109,18 +1107,18 @@ class GrampsDbXmlWriter(UpdateCallback):
|
||||
if self.strip_photos == 1:
|
||||
path = os.path.basename(path)
|
||||
elif self.strip_photos == 2 and (len(path)>0 and os.path.isabs(path)):
|
||||
drive,path = os.path.splitdrive(path)
|
||||
drive, path = os.path.splitdrive(path)
|
||||
path = path[1:]
|
||||
|
||||
self.g.write('%s<file src="%s" mime="%s"%s/>\n'
|
||||
% (" "*(index+1),self.fix(path),mime_type,desc_text))
|
||||
% (" "*(index+1), self.fix(path), mime_type, desc_text))
|
||||
self.write_attribute_list(obj.get_attribute_list())
|
||||
self.write_note_list(obj.get_note_list(),index+1)
|
||||
self.write_note_list(obj.get_note_list(), index+1)
|
||||
dval = obj.get_date_object()
|
||||
if not dval.is_empty():
|
||||
self.write_date(dval,index+1)
|
||||
self.write_date(dval, index+1)
|
||||
for s in obj.get_source_references():
|
||||
self.dump_source_ref(s,index+1)
|
||||
self.dump_source_ref(s, index+1)
|
||||
self.g.write("%s</object>\n" % (" "*index))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -322,7 +322,7 @@ class GedcomWriter(BasicUtils.UpdateCallback):
|
||||
|
||||
self.__writeln(0, "TRLR")
|
||||
self.gedcom_file.close()
|
||||
return 1
|
||||
return True
|
||||
|
||||
def __writeln(self, level, token, textlines="", limit=72):
|
||||
"""
|
||||
@ -1378,7 +1378,7 @@ def export_data(database, filename, person, option_box, callback=None):
|
||||
"""
|
||||
External interface used to register with the plugin system.
|
||||
"""
|
||||
ret = 0
|
||||
ret = False
|
||||
try:
|
||||
ged_write = GedcomWriter(database, person, 0,
|
||||
option_box, callback)
|
||||
|
@ -137,27 +137,27 @@ def load_plugins(direct):
|
||||
# Plugin registering
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def register_export(exportData,title,description='',config=None,filename=''):
|
||||
def register_export(exportData, title, description='', config=None, filename=''):
|
||||
"""
|
||||
Register an export filter, taking the task, file filter,
|
||||
and the list of patterns for the filename matching.
|
||||
"""
|
||||
if description and filename:
|
||||
del_index = -1
|
||||
for i in range(0,len(export_list)):
|
||||
for i in range(0, len(export_list)):
|
||||
if export_list[i][1] == title:
|
||||
del_index = i
|
||||
if del_index != -1:
|
||||
del export_list[del_index]
|
||||
|
||||
export_list.append((exportData,title,description,config,filename))
|
||||
export_list.append((exportData, title, description, config, filename))
|
||||
mod2text[exportData.__module__] = description
|
||||
|
||||
def register_import(task, ffilter, mime=None, native_format=0, format_name=""):
|
||||
"""Register an import filter, taking the task and file filter"""
|
||||
if mime:
|
||||
del_index = -1
|
||||
for i in range(0,len(import_list)):
|
||||
for i in range(0, len(import_list)):
|
||||
if import_list[i][2] == mime:
|
||||
del_index = i
|
||||
if del_index != -1:
|
||||
|
@ -69,10 +69,8 @@ import DateHandler
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def exportData(database,filename,person,option_box,callback=None):
|
||||
ret = 0
|
||||
gw = CSVWriter(database,person,0,filename,option_box,callback)
|
||||
ret = gw.export_data()
|
||||
return ret
|
||||
return gw.export_data()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -333,10 +331,10 @@ class CSVWriter:
|
||||
except IOError,msg:
|
||||
msg2 = _("Could not create %s") % self.filename
|
||||
ErrorDialog(msg2,str(msg))
|
||||
return 0
|
||||
return False
|
||||
except:
|
||||
ErrorDialog(_("Could not create %s") % self.filename)
|
||||
return 0
|
||||
return False
|
||||
######################### initialize progress bar
|
||||
self.count = 0
|
||||
self.total = 0
|
||||
@ -490,7 +488,7 @@ class CSVWriter:
|
||||
self.update()
|
||||
self.writeln()
|
||||
self.g.close()
|
||||
return 1
|
||||
return True
|
||||
|
||||
def format_date(self, date):
|
||||
return DateHandler.get_date(date)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2004 Martin Hawlisch
|
||||
# Copyright (C) 2005-2006 Donald N. Allingham
|
||||
# Copyright (C) 2005-2006, 2008 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -53,7 +53,7 @@ log = logging.getLogger(".ExportVCal")
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Filters import GenericFilter, Rules, build_filter_menu
|
||||
import const
|
||||
#import const
|
||||
import Utils
|
||||
from gen.lib import Date, EventType
|
||||
import Errors
|
||||
@ -70,7 +70,7 @@ class CalendarWriterOptionBox:
|
||||
Create a VBox with the option widgets and define methods to retrieve
|
||||
the options.
|
||||
"""
|
||||
def __init__(self,person):
|
||||
def __init__(self, person):
|
||||
self.person = person
|
||||
|
||||
def get_option_box(self):
|
||||
@ -79,7 +79,7 @@ class CalendarWriterOptionBox:
|
||||
if not os.path.isfile(glade_file):
|
||||
glade_file = "plugins/vcalendarexport.glade"
|
||||
|
||||
self.topDialog = gtk.glade.XML(glade_file,"calendarExport","gramps")
|
||||
self.topDialog = gtk.glade.XML(glade_file, "calendarExport", "gramps")
|
||||
|
||||
filter_obj = self.topDialog.get_widget("filter")
|
||||
self.copy = 0
|
||||
@ -109,7 +109,7 @@ class CalendarWriterOptionBox:
|
||||
com.add_rule(Rules.Person.HasCommonAncestorWith(
|
||||
[self.person.get_gramps_id()]))
|
||||
|
||||
the_filters += [all,des,ans,com]
|
||||
the_filters += [all, des, ans, com]
|
||||
|
||||
from Filters import CustomFilters
|
||||
the_filters.extend(CustomFilters.get_filters('Person'))
|
||||
@ -127,8 +127,8 @@ class CalendarWriterOptionBox:
|
||||
|
||||
|
||||
class CalendarWriter:
|
||||
def __init__(self,database,person,cl=0,filename="",
|
||||
option_box=None,callback=None):
|
||||
def __init__(self, database, person, cl=0, filename="", option_box=None,
|
||||
callback=None):
|
||||
self.db = database
|
||||
self.person = person
|
||||
self.option_box = option_box
|
||||
@ -160,8 +160,8 @@ class CalendarWriter:
|
||||
for p in self.option_box.cfilter.apply(self.db, self.db.get_person_handles(sort_handles=False)):
|
||||
self.plist[p] = 1
|
||||
except Errors.FilterError, msg:
|
||||
(m1,m2) = msg.messages()
|
||||
ErrorDialog(m1,m2)
|
||||
(m1, m2) = msg.messages()
|
||||
ErrorDialog(m1, m2)
|
||||
return
|
||||
|
||||
self.flist = {}
|
||||
@ -191,21 +191,21 @@ class CalendarWriter:
|
||||
for family_handle in p.get_family_handle_list():
|
||||
self.flist[family_handle] = 1
|
||||
|
||||
def writeln(self,text):
|
||||
def writeln(self, text):
|
||||
self.g.write('%s\n' % (text.encode('iso-8859-1')))
|
||||
|
||||
def export_data(self,filename):
|
||||
def export_data(self, filename):
|
||||
|
||||
self.dirname = os.path.dirname (filename)
|
||||
try:
|
||||
self.g = open(filename,"w")
|
||||
except IOError,msg:
|
||||
msg2 = _("Could not create %s") % filename
|
||||
ErrorDialog(msg2,str(msg))
|
||||
return 0
|
||||
ErrorDialog(msg2, str(msg))
|
||||
return False
|
||||
except:
|
||||
ErrorDialog(_("Could not create %s") % filename)
|
||||
return 0
|
||||
return False
|
||||
|
||||
self.writeln("BEGIN:VCALENDAR");
|
||||
self.writeln("PRODID:-//GNU//Gramps//EN");
|
||||
@ -226,9 +226,9 @@ class CalendarWriter:
|
||||
self.writeln("END:VCALENDAR");
|
||||
|
||||
self.g.close()
|
||||
return 1
|
||||
return True
|
||||
|
||||
def write_family(self,family_handle):
|
||||
def write_family(self, family_handle):
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
if family:
|
||||
for event_ref in family.get_event_ref_list():
|
||||
@ -236,7 +236,8 @@ class CalendarWriter:
|
||||
if event.get_type() == EventType.MARRIAGE:
|
||||
m_date = event.get_date_object()
|
||||
place_handle = event.get_place_handle()
|
||||
text = _("Marriage of %s") % Utils.family_name(family,self.db)
|
||||
text = _("Marriage of %s") % Utils.family_name(family,
|
||||
self.db)
|
||||
if place_handle:
|
||||
place = self.db.get_place_from_handle(place_handle)
|
||||
self.write_vevent( text, m_date, place.get_title())
|
||||
@ -271,9 +272,9 @@ class CalendarWriter:
|
||||
self.write_vevent(_("Death of %s") % person.get_primary_name().get_name(), d_date)
|
||||
|
||||
|
||||
def format_single_date(self,subdate,thisyear,cal):
|
||||
def format_single_date(self, subdate, thisyear, cal):
|
||||
retval = ""
|
||||
(day,month,year,sl) = subdate
|
||||
(day, month, year, sl) = subdate
|
||||
|
||||
if thisyear:
|
||||
year = localtime().tm_year
|
||||
@ -288,7 +289,7 @@ class CalendarWriter:
|
||||
return retval
|
||||
|
||||
|
||||
def format_date(self,date,thisyear=0):
|
||||
def format_date(self, date, thisyear=0):
|
||||
retval = ""
|
||||
if date.get_modifier() == Date.MOD_TEXTONLY:
|
||||
return ""
|
||||
@ -296,14 +297,19 @@ class CalendarWriter:
|
||||
mod = date.get_modifier()
|
||||
cal = cal = date.get_calendar()
|
||||
if mod == Date.MOD_SPAN or mod == Date.MOD_RANGE:
|
||||
start = self.format_single_date(date.get_start_date(),thisyear,cal)
|
||||
end = self.format_single_date(date.get_stop_date(),thisyear,cal)
|
||||
start = self.format_single_date(date.get_start_date(),
|
||||
thisyear, cal)
|
||||
end = self.format_single_date(date.get_stop_date(),
|
||||
thisyear, cal)
|
||||
if start and end:
|
||||
retval = "DTSTART:%sT000001\nDTEND:%sT235959" % (start,end)
|
||||
retval = "DTSTART:%sT000001\nDTEND:%sT235959" % (start,
|
||||
end)
|
||||
elif mod == Date.MOD_NONE:
|
||||
start = self.format_single_date(date.get_start_date(),thisyear,cal)
|
||||
start = self.format_single_date(date.get_start_date(),
|
||||
thisyear, cal)
|
||||
if start:
|
||||
retval = "DTSTART:%sT000001\nDTEND:%sT235959" % (start,start)
|
||||
retval = "DTSTART:%sT000001\nDTEND:%sT235959" % (start,
|
||||
start)
|
||||
return retval
|
||||
|
||||
def write_vevent(self, event_text, date, location=""):
|
||||
@ -317,7 +323,7 @@ class CalendarWriter:
|
||||
self.writeln(date_string)
|
||||
self.writeln("END:VEVENT");
|
||||
|
||||
date_string = self.format_date(date,1)
|
||||
date_string = self.format_date(date, 1)
|
||||
self.writeln("");
|
||||
self.writeln("BEGIN:VEVENT");
|
||||
self.writeln("SUMMARY:"+_("Anniversary: %s") % event_text);
|
||||
@ -332,11 +338,9 @@ class CalendarWriter:
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def exportData(database,filename,person,option_box,callback=None):
|
||||
ret = 0
|
||||
cw = CalendarWriter(database,person,0,filename,option_box,callback)
|
||||
ret = cw.export_data(filename)
|
||||
return ret
|
||||
def exportData(database, filename, person, option_box, callback=None):
|
||||
cw = CalendarWriter(database, person, 0, filename, option_box, callback)
|
||||
return cw.export_data(filename)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -345,7 +349,7 @@ def exportData(database,filename,person,option_box,callback=None):
|
||||
#-------------------------------------------------------------------------
|
||||
_title = _('vCalendar')
|
||||
_description = _('vCalendar is used in many calendaring and pim applications.')
|
||||
_config = (_('vCalendar export options'),CalendarWriterOptionBox)
|
||||
_config = (_('vCalendar export options'), CalendarWriterOptionBox)
|
||||
_filename = 'vcs'
|
||||
|
||||
register_export(exportData,_title,_description,_config,_filename)
|
||||
register_export(exportData, _title, _description, _config, _filename)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2004 Martin Hawlisch
|
||||
# Copyright (C) 2005-2006 Donald N. Allingham
|
||||
# Copyright (C) 2005-2008 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -66,7 +66,7 @@ class CardWriterOptionBox:
|
||||
Create a VBox with the option widgets and define methods to retrieve
|
||||
the options.
|
||||
"""
|
||||
def __init__(self,person):
|
||||
def __init__(self, person):
|
||||
self.person = person
|
||||
|
||||
def get_option_box(self):
|
||||
@ -105,7 +105,7 @@ class CardWriterOptionBox:
|
||||
com.add_rule(Rules.Person.HasCommonAncestorWith(
|
||||
[self.person.get_gramps_id()]))
|
||||
|
||||
the_filters += [all,des,ans,com]
|
||||
the_filters += [all, des, ans, com]
|
||||
|
||||
from Filters import CustomFilters
|
||||
the_filters.extend(CustomFilters.get_filters('Person'))
|
||||
@ -122,8 +122,8 @@ class CardWriterOptionBox:
|
||||
self.cfilter = self.filter_menu.get_active().get_data("filter")
|
||||
|
||||
class CardWriter:
|
||||
def __init__(self,database,person,cl=0,filename="",
|
||||
option_box=None,callback=None):
|
||||
def __init__(self, database, person, cl=0, filename="", option_box=None,
|
||||
callback=None):
|
||||
self.db = database
|
||||
self.person = person
|
||||
self.option_box = option_box
|
||||
@ -147,11 +147,12 @@ class CardWriter:
|
||||
self.plist[p] = 1
|
||||
else:
|
||||
try:
|
||||
for p in self.option_box.cfilter.apply(self.db, self.db.get_person_handles(sort_handles=False)):
|
||||
for p in self.option_box.cfilter.apply(self.db,
|
||||
self.db.get_person_handles(sort_handles=False)):
|
||||
self.plist[p] = 1
|
||||
except Errors.FilterError, msg:
|
||||
(m1,m2) = msg.messages()
|
||||
ErrorDialog(m1,m2)
|
||||
(m1, m2) = msg.messages()
|
||||
ErrorDialog(m1, m2)
|
||||
return
|
||||
|
||||
def update_empty(self):
|
||||
@ -168,21 +169,21 @@ class CardWriter:
|
||||
for p in self.db.get_person_handles(sort_handles=False):
|
||||
self.plist[p] = 1
|
||||
|
||||
def writeln(self,text):
|
||||
def writeln(self, text):
|
||||
self.g.write('%s\n' % (text.encode('iso-8859-1')))
|
||||
|
||||
def export_data(self,filename):
|
||||
def export_data(self, filename):
|
||||
|
||||
self.dirname = os.path.dirname (filename)
|
||||
try:
|
||||
self.g = open(filename,"w")
|
||||
except IOError,msg:
|
||||
msg2 = _("Could not create %s") % filename
|
||||
ErrorDialog(msg2,str(msg))
|
||||
return 0
|
||||
ErrorDialog(msg2, str(msg))
|
||||
return False
|
||||
except:
|
||||
ErrorDialog(_("Could not create %s") % filename)
|
||||
return 0
|
||||
return False
|
||||
|
||||
self.count = 0
|
||||
self.oldval = 0
|
||||
@ -192,7 +193,7 @@ class CardWriter:
|
||||
self.update()
|
||||
|
||||
self.g.close()
|
||||
return 1
|
||||
return True
|
||||
|
||||
def write_person(self, person_handle):
|
||||
person = self.db.get_person_from_handle(person_handle)
|
||||
@ -215,9 +216,10 @@ class CardWriter:
|
||||
not b_date.is_empty() and
|
||||
not mod == Date.MOD_SPAN and
|
||||
not mod == Date.MOD_RANGE):
|
||||
(day,month,year,sl) = b_date.get_start_date()
|
||||
(day, month, year, sl) = b_date.get_start_date()
|
||||
if day > 0 and month > 0 and year > 0:
|
||||
self.writeln("BDAY:%s-%02d-%02d" % (year,month,day))
|
||||
self.writeln("BDAY:%s-%02d-%02d" % (year, month,
|
||||
day))
|
||||
|
||||
address_list = person.get_address_list()
|
||||
for address in address_list:
|
||||
@ -229,7 +231,10 @@ class CardWriter:
|
||||
zip = address.get_postal_code()
|
||||
country = address.get_country()
|
||||
if street or city or state or zip or country:
|
||||
self.writeln("ADR:%s;%s;%s;%s;%s;%s;%s" % (postbox,ext,street,city,state,zip,country))
|
||||
self.writeln("ADR:%s;%s;%s;%s;%s;%s;%s" % (postbox, ext,
|
||||
street, city,
|
||||
state, zip,
|
||||
country))
|
||||
|
||||
phone = address.get_phone()
|
||||
if phone:
|
||||
@ -249,11 +254,9 @@ class CardWriter:
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def exportData(database,filename,person,option_box,callback=None):
|
||||
ret = 0
|
||||
cw = CardWriter(database,person,0,filename,option_box,callback)
|
||||
ret = cw.export_data(filename)
|
||||
return ret
|
||||
def exportData(database, filename, person, option_box, callback=None):
|
||||
cw = CardWriter(database, person, 0, filename, option_box, callback)
|
||||
return cw.export_data(filename)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -262,7 +265,7 @@ def exportData(database,filename,person,option_box,callback=None):
|
||||
#-------------------------------------------------------------------------
|
||||
_title = _('vCard')
|
||||
_description = _('vCard is used in many addressbook and pim applications.')
|
||||
_config = (_('vCard export options'),CardWriterOptionBox)
|
||||
_config = (_('vCard export options'), CardWriterOptionBox)
|
||||
_filename = 'vcf'
|
||||
|
||||
register_export(exportData,_title,_description,_config,_filename)
|
||||
register_export(exportData, _title, _description, _config, _filename)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2000-2008 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -29,7 +29,7 @@
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import sys
|
||||
from cStringIO import StringIO
|
||||
#from cStringIO import StringIO
|
||||
from gettext import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -67,8 +67,8 @@ except:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from GrampsDbUtils import XmlWriter
|
||||
import Mime
|
||||
import const
|
||||
#import Mime
|
||||
#import const
|
||||
import QuestionDialog
|
||||
from PluginUtils import register_export
|
||||
|
||||
@ -80,9 +80,8 @@ _title_string = _("Export to CD")
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def writeData(database, filename, person, option_box=None, callback=None):
|
||||
ret = 0
|
||||
writer = PackageWriter(database, filename, callback)
|
||||
writer.export()
|
||||
return writer.export()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -99,9 +98,9 @@ class PackageWriter:
|
||||
|
||||
def export(self):
|
||||
if self.cl:
|
||||
self.cl_run()
|
||||
return self.cl_run()
|
||||
else:
|
||||
self.gui_run()
|
||||
return self.gui_run()
|
||||
|
||||
def cl_run(self):
|
||||
base = os.path.basename(self.filename)
|
||||
@ -112,12 +111,12 @@ class PackageWriter:
|
||||
except FileExistsError, msg:
|
||||
QuestionDialog.ErrorDialog(_("CD export preparation failed"),
|
||||
"1 %s " % str(msg))
|
||||
return
|
||||
return False
|
||||
except:
|
||||
uri_name = "burn:///" + base
|
||||
QuestionDialog.ErrorDialog("CD export preparation failed",
|
||||
'Could not create %s' % uri_name)
|
||||
return
|
||||
return False
|
||||
|
||||
for obj_id in self.db.get_media_object_handles():
|
||||
obj = self.db.get_object_from_handle(obj_id)
|
||||
@ -134,6 +133,7 @@ class PackageWriter:
|
||||
gfile = XmlWriter(self.db, None, 2)
|
||||
gfile.write_handle(g)
|
||||
g.close()
|
||||
return True
|
||||
|
||||
def gui_run(self):
|
||||
missmedia_action = 0
|
||||
@ -146,12 +146,12 @@ class PackageWriter:
|
||||
except FileExistsError:
|
||||
QuestionDialog.ErrorDialog(_("CD export preparation failed"),
|
||||
"File already exists")
|
||||
return
|
||||
return False
|
||||
except:
|
||||
uri_name = "burn:///" + base
|
||||
QuestionDialog.ErrorDialog(_("CD export preparation failed"),
|
||||
_('Could not create %s') % uri_name)
|
||||
return
|
||||
return False
|
||||
|
||||
try:
|
||||
uri = URI('burn:///%s/.thumb' % base)
|
||||
@ -159,12 +159,12 @@ class PackageWriter:
|
||||
except FileExistsError, msg:
|
||||
QuestionDialog.ErrorDialog("CD export preparation failed",
|
||||
"4 %s " % str(msg))
|
||||
return
|
||||
return False
|
||||
except:
|
||||
uri_name = "burn:///" + base + "/.thumb"
|
||||
QuestionDialog.ErrorDialog(_("CD export preparation failed"),
|
||||
_('Could not create %s') % uri_name)
|
||||
return
|
||||
return False
|
||||
|
||||
#--------------------------------------------------------
|
||||
def remove_clicked():
|
||||
@ -272,7 +272,7 @@ class PackageWriter:
|
||||
gfile.write_handle(g)
|
||||
g.close()
|
||||
os.system("nautilus --no-desktop burn:///")
|
||||
return 1
|
||||
return True
|
||||
|
||||
def copy_file(self, src, dest):
|
||||
original = open(src, "r")
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2003-2006 Donald N. Allingham
|
||||
# Copyright (C) 2003-2006, 2008 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -63,18 +63,16 @@ from PluginUtils import register_export
|
||||
# writeData
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def writeData(database,filename,person,option_box,callback=None):
|
||||
ret = 0
|
||||
writer = FtreeWriter(database,person,0,filename,option_box,callback)
|
||||
ret = writer.export_data()
|
||||
return ret
|
||||
def writeData(database, filename, person, option_box, callback=None):
|
||||
writer = FtreeWriter(database, person, 0, filename, option_box, callback)
|
||||
return writer.export_data()
|
||||
|
||||
class FtreeWriterOptionBox:
|
||||
"""
|
||||
Create a VBox with the option widgets and define methods to retrieve
|
||||
the options.
|
||||
"""
|
||||
def __init__(self,person):
|
||||
def __init__(self, person):
|
||||
self.person = person
|
||||
|
||||
def get_option_box(self):
|
||||
@ -82,7 +80,7 @@ class FtreeWriterOptionBox:
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = "%s/%s" % (base,"writeftree.glade")
|
||||
|
||||
self.top = gtk.glade.XML(glade_file,"top","gramps")
|
||||
self.top = gtk.glade.XML(glade_file, "top", "gramps")
|
||||
|
||||
filter_obj = self.top.get_widget("filter")
|
||||
|
||||
@ -111,7 +109,7 @@ class FtreeWriterOptionBox:
|
||||
com.add_rule(Rules.Person.HasCommonAncestorWith(
|
||||
[self.person.get_gramps_id()]))
|
||||
|
||||
the_filters += [all,des,ans,com]
|
||||
the_filters += [all, des, ans, com]
|
||||
|
||||
from Filters import CustomFilters
|
||||
the_filters.extend(CustomFilters.get_filters('Person'))
|
||||
@ -135,8 +133,8 @@ class FtreeWriterOptionBox:
|
||||
#-------------------------------------------------------------------------
|
||||
class FtreeWriter:
|
||||
|
||||
def __init__(self,database,person,cl=0,filename="",
|
||||
option_box=None,callback = None):
|
||||
def __init__(self, database, person, cl=0, filename="", option_box=None,
|
||||
callback = None):
|
||||
self.db = database
|
||||
self.person = person
|
||||
self.option_box = option_box
|
||||
@ -164,8 +162,8 @@ class FtreeWriter:
|
||||
for p in self.option_box.cfilter.apply(self.db, self.db.get_person_handles(sort_handles=False)):
|
||||
self.plist[p] = 1
|
||||
except Errors.FilterError, msg:
|
||||
(m1,m2) = msg.messages()
|
||||
ErrorDialog(m1,m2)
|
||||
(m1, m2) = msg.messages()
|
||||
ErrorDialog(m1, m2)
|
||||
return
|
||||
|
||||
def update_empty(self):
|
||||
@ -197,7 +195,7 @@ class FtreeWriter:
|
||||
sn = pn.get_surname()
|
||||
items = pn.get_first_name().split()
|
||||
if len(items) > 0:
|
||||
n = "%s %s" % (items[0],sn)
|
||||
n = "%s %s" % (items[0], sn)
|
||||
else:
|
||||
n = sn
|
||||
|
||||
@ -205,7 +203,7 @@ class FtreeWriter:
|
||||
if name_map.has_key(n):
|
||||
count = 0
|
||||
while 1:
|
||||
nn = "%s%d" % (n,count)
|
||||
nn = "%s%d" % (n, count)
|
||||
if not name_map.has_key(nn):
|
||||
break;
|
||||
count += 1
|
||||
@ -214,7 +212,7 @@ class FtreeWriter:
|
||||
else:
|
||||
name_map[n] = key
|
||||
id_map[key] = n
|
||||
id_name[key] = get_name(pn,count)
|
||||
id_name[key] = get_name(pn, count)
|
||||
|
||||
f = open(self.filename,"w")
|
||||
|
||||
@ -252,13 +250,13 @@ class FtreeWriter:
|
||||
death = None
|
||||
|
||||
if self.restrict:
|
||||
alive = Utils.probably_alive(p,self.db)
|
||||
alive = Utils.probably_alive(p, self.db)
|
||||
else:
|
||||
alive = 0
|
||||
|
||||
if birth and not alive:
|
||||
if death and not alive :
|
||||
dates = "%s-%s" % (fdate(birth),fdate(death))
|
||||
dates = "%s-%s" % (fdate(birth), fdate(death))
|
||||
else:
|
||||
dates = fdate(birth)
|
||||
else:
|
||||
@ -267,24 +265,26 @@ class FtreeWriter:
|
||||
else:
|
||||
dates = ""
|
||||
|
||||
f.write('%s;%s;%s;%s;%s;%s\n' % (name,father,mother,email,web,dates))
|
||||
f.write('%s;%s;%s;%s;%s;%s\n' % (name, father, mother, email, web,
|
||||
dates))
|
||||
|
||||
f.close()
|
||||
return 1
|
||||
return True
|
||||
|
||||
def fdate(val):
|
||||
if val.get_year_valid():
|
||||
if val.get_month_valid():
|
||||
if val.get_day_valid():
|
||||
return "%d/%d/%d" % (val.get_day(),val.get_month(),val.get_year())
|
||||
return "%d/%d/%d" % (val.get_day(), val.get_month(),
|
||||
val.get_year())
|
||||
else:
|
||||
return "%d/%d" % (val.get_month(),val.get_year())
|
||||
return "%d/%d" % (val.get_month(), val.get_year())
|
||||
else:
|
||||
return "%d" % val.get_year()
|
||||
else:
|
||||
return ""
|
||||
|
||||
def get_name(name,count):
|
||||
def get_name(name, count):
|
||||
"""returns a name string built from the components of the Name
|
||||
instance, in the form of Firstname Surname"""
|
||||
if count == -1:
|
||||
@ -310,7 +310,7 @@ def get_name(name,count):
|
||||
#-------------------------------------------------------------------------
|
||||
_title = _('_Web Family Tree')
|
||||
_description = _('Web Family Tree format.')
|
||||
_config = (_('Web Family Tree export options'),FtreeWriterOptionBox)
|
||||
_config = (_('Web Family Tree export options'), FtreeWriterOptionBox)
|
||||
_filename = 'wft'
|
||||
|
||||
register_export(writeData,_title,_description,_config,_filename)
|
||||
register_export(writeData, _title, _description, _config,_filename)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2004 Martin Hawlisch
|
||||
# Copyright (C) 2004-2006 Donald N. Allingham
|
||||
# Copyright (C) 2004-2006, 2008 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -53,7 +53,7 @@ log = logging.getLogger(".WriteGeneWeb")
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
from Filters import GenericFilter, Rules, build_filter_menu
|
||||
import const
|
||||
#import const
|
||||
import Utils
|
||||
import Errors
|
||||
from QuestionDialog import ErrorDialog
|
||||
@ -69,7 +69,7 @@ class GeneWebWriterOptionBox:
|
||||
Create a VBox with the option widgets and define methods to retrieve
|
||||
the options.
|
||||
"""
|
||||
def __init__(self,person):
|
||||
def __init__(self, person):
|
||||
self.person = person
|
||||
|
||||
def get_option_box(self):
|
||||
@ -80,7 +80,7 @@ class GeneWebWriterOptionBox:
|
||||
if not os.path.isfile(glade_file):
|
||||
glade_file = "plugins/genewebexport.glade"
|
||||
|
||||
self.topDialog = gtk.glade.XML(glade_file,"genewebExport","gramps")
|
||||
self.topDialog = gtk.glade.XML(glade_file, "genewebExport", "gramps")
|
||||
self.topDialog.signal_autoconnect({
|
||||
"on_restrict_toggled": self.on_restrict_toggled
|
||||
})
|
||||
@ -113,7 +113,7 @@ class GeneWebWriterOptionBox:
|
||||
com.add_rule(Rules.Person.HasCommonAncestorWith(
|
||||
[self.person.get_gramps_id()]))
|
||||
|
||||
the_filters += [all,des,ans,com]
|
||||
the_filters += [all, des, ans, com]
|
||||
|
||||
from Filters import CustomFilters
|
||||
the_filters.extend(CustomFilters.get_filters('Person'))
|
||||
@ -126,7 +126,7 @@ class GeneWebWriterOptionBox:
|
||||
self.topDialog.get_widget("genewebExport").destroy()
|
||||
return the_box
|
||||
|
||||
def on_restrict_toggled(self,restrict):
|
||||
def on_restrict_toggled(self, restrict):
|
||||
active = restrict.get_active ()
|
||||
map (lambda x: x.set_sensitive (active),
|
||||
[self.topDialog.get_widget("living"),
|
||||
@ -153,8 +153,8 @@ class GeneWebWriterOptionBox:
|
||||
self.images_path = ""
|
||||
|
||||
class GeneWebWriter:
|
||||
def __init__(self,database,person,cl=0,filename="",
|
||||
option_box=None,callback=None):
|
||||
def __init__(self, database, person, cl=0, filename="", option_box=None,
|
||||
callback=None):
|
||||
self.db = database
|
||||
self.person = person
|
||||
self.option_box = option_box
|
||||
@ -195,8 +195,8 @@ class GeneWebWriter:
|
||||
for p in self.option_box.cfilter.apply(self.db, self.db.get_person_handles(sort_handles=False)):
|
||||
self.plist[p] = 1
|
||||
except Errors.FilterError, msg:
|
||||
(m1,m2) = msg.messages()
|
||||
ErrorDialog(m1,m2)
|
||||
(m1, m2) = msg.messages()
|
||||
ErrorDialog(m1, m2)
|
||||
return
|
||||
|
||||
self.flist = {}
|
||||
@ -244,25 +244,25 @@ class GeneWebWriter:
|
||||
for family_handle in p.get_family_handle_list():
|
||||
self.flist[family_handle] = 1
|
||||
|
||||
def writeln(self,text):
|
||||
def writeln(self, text):
|
||||
self.g.write(self.iso8859('%s\n' % (text)))
|
||||
|
||||
def export_data(self):
|
||||
|
||||
self.dirname = os.path.dirname (self.filename)
|
||||
try:
|
||||
self.g = open(self.filename,"w")
|
||||
self.g = open(self.filename, "w")
|
||||
except IOError,msg:
|
||||
msg2 = _("Could not create %s") % self.filename
|
||||
ErrorDialog(msg2,str(msg))
|
||||
return 0
|
||||
ErrorDialog(msg2, str(msg))
|
||||
return False
|
||||
except:
|
||||
ErrorDialog(_("Could not create %s") % self.filename)
|
||||
return 0
|
||||
return False
|
||||
|
||||
if len(self.flist) < 1:
|
||||
ErrorDialog(_("No families matched by selected filter"))
|
||||
return 0
|
||||
return False
|
||||
|
||||
self.count = 0
|
||||
self.oldval = 0
|
||||
@ -272,9 +272,9 @@ class GeneWebWriter:
|
||||
self.writeln("")
|
||||
|
||||
self.g.close()
|
||||
return 1
|
||||
return True
|
||||
|
||||
def write_family(self,family_handle):
|
||||
def write_family(self, family_handle):
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
if family:
|
||||
self.update()
|
||||
@ -303,7 +303,7 @@ class GeneWebWriter:
|
||||
note = note.replace('\r',' ')
|
||||
self.writeln("comm %s" % note)
|
||||
|
||||
def write_witness(self,family):
|
||||
def write_witness(self, family):
|
||||
# FIXME: witnesses are not in events anymore
|
||||
return
|
||||
|
||||
@ -570,9 +570,9 @@ class GeneWebWriter:
|
||||
ret = ret + source.get_title()
|
||||
return ret
|
||||
|
||||
def format_single_date(self,subdate,cal,mode):
|
||||
def format_single_date(self, subdate, cal, mode):
|
||||
retval = ""
|
||||
(day,month,year,sl) = subdate
|
||||
(day, month, year, sl) = subdate
|
||||
|
||||
cal_type = ""
|
||||
if cal == gen.lib.Date.CAL_HEBREW:
|
||||
@ -625,10 +625,8 @@ class GeneWebWriter:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def exportData(database,filename,person,option_box,callback=None):
|
||||
ret = 0
|
||||
gw = GeneWebWriter(database,person,0,filename,option_box,callback)
|
||||
ret = gw.export_data()
|
||||
return ret
|
||||
return gw.export_data()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -637,7 +635,7 @@ def exportData(database,filename,person,option_box,callback=None):
|
||||
#-------------------------------------------------------------------------
|
||||
_title = _('G_eneWeb')
|
||||
_description = _('GeneWeb is a web based genealogy program.')
|
||||
_config = (_('GeneWeb export options'),GeneWebWriterOptionBox)
|
||||
_config = (_('GeneWeb export options'), GeneWebWriterOptionBox)
|
||||
_filename = 'gw'
|
||||
|
||||
register_export(exportData,_title,_description,_config,_filename)
|
||||
register_export(exportData, _title, _description, _config, _filename)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||
# Copyright (C) 2000-2008 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -34,7 +34,7 @@ import tarfile
|
||||
from cStringIO import StringIO
|
||||
from gettext import gettext as _
|
||||
import ExportOptions
|
||||
from BasicUtils import UpdateCallback
|
||||
#from BasicUtils import UpdateCallback
|
||||
import gen.proxy
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -60,7 +60,7 @@ import gtk.glade
|
||||
#-------------------------------------------------------------------------
|
||||
from GrampsDbUtils import XmlWriter
|
||||
import Utils
|
||||
from QuestionDialog import MissingMediaDialog
|
||||
#from QuestionDialog import MissingMediaDialog
|
||||
from PluginUtils import register_export
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -69,8 +69,6 @@ from PluginUtils import register_export
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def writeData(database, filename, person, option_box, callback=None):
|
||||
ret = 0
|
||||
|
||||
option_box.parse_options()
|
||||
|
||||
restrict = option_box.restrict
|
||||
@ -86,10 +84,8 @@ def writeData(database, filename, person, option_box, callback=None):
|
||||
if not option_box.cfilter.is_empty():
|
||||
database = gen.proxy.FilterProxyDb(database, option_box.cfilter)
|
||||
|
||||
|
||||
writer = PackageWriter(database, filename, callback)
|
||||
ret = writer.export()
|
||||
return ret
|
||||
return writer.export()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -98,13 +94,13 @@ def writeData(database, filename, person, option_box, callback=None):
|
||||
#-------------------------------------------------------------------------
|
||||
class PackageWriter:
|
||||
|
||||
def __init__(self,database,filename,callback):
|
||||
def __init__(self, database, filename, callback):
|
||||
self.db = database
|
||||
self.callback = callback
|
||||
self.filename = filename
|
||||
|
||||
def export(self):
|
||||
missmedia_action = 0
|
||||
# missmedia_action = 0
|
||||
#--------------------------------------------------------------
|
||||
def remove_clicked():
|
||||
# File is lost => remove all references and the object itself
|
||||
@ -214,11 +210,11 @@ class PackageWriter:
|
||||
tarinfo.uid = os.getuid()
|
||||
tarinfo.gid = os.getgid()
|
||||
g.seek(0)
|
||||
archive.addfile(tarinfo,g)
|
||||
archive.addfile(tarinfo, g)
|
||||
archive.close()
|
||||
g.close()
|
||||
|
||||
return 1
|
||||
return True
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user