* src/Report.py (parse_target_frame): Remove unneeded check; when

checking existing file/dir, make sure we requested file/dir,
correspondingly.
* src/plugins/NavWebPage (archive_toggle): Add/remove '.tar.gz'
to path when this options is turned on/off.


svn: r5520
This commit is contained in:
Alex Roitman 2005-12-09 20:14:52 +00:00
parent 7704cd4f54
commit c0855147df
3 changed files with 26 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2005-12-09 Alex Roitman <shura@gramps-project.org>
* src/Report.py (parse_target_frame): Remove unneeded check; when
checking existing file/dir, make sure we requested file/dir,
correspondingly.
* src/plugins/NavWebPage (archive_toggle): Add/remove '.tar.gz'
to path when this options is turned on/off.
2005-12-08 Don Allingham <don@gramps-project.org> 2005-12-08 Don Allingham <don@gramps-project.org>
* src/Merge.py: fix date comparison * src/Merge.py: fix date comparison
* src/Utils.py: add xml:lang generation function * src/Utils.py: add xml:lang generation function

View File

@ -1412,15 +1412,10 @@ class ReportDialog(BareReportDialog):
# First we check whether the selected path exists # First we check whether the selected path exists
if os.path.exists(self.target_path): if os.path.exists(self.target_path):
# selected path is an existing dir # selected path is an existing dir and we need a dir
if os.path.isdir(self.target_path): if os.path.isdir(self.target_path) \
# check whether we asked for a dir and self.get_target_is_directory():
if not self.get_target_is_directory():
ErrorDialog(_("Invalid file name"),
_("The filename that you gave is a "
"directory.\n"
"You need to provide a valid filename."))
return None
# check whether the dir has rwx permissions # check whether the dir has rwx permissions
if not os.access(self.target_path,os.R_OK|os.W_OK|os.X_OK): if not os.access(self.target_path,os.R_OK|os.W_OK|os.X_OK):
ErrorDialog(_('Permission problem'), ErrorDialog(_('Permission problem'),
@ -1431,8 +1426,9 @@ class ReportDialog(BareReportDialog):
) )
return None return None
# selected path is an exsting file # selected path is an exsting file and we need a file
if os.path.isfile(self.target_path): if os.path.isfile(self.target_path) \
and not self.get_target_is_directory():
a = OptionDialog(_('File already exists'), a = OptionDialog(_('File already exists'),
_('You can choose to either overwrite the ' _('You can choose to either overwrite the '
'file, or change the selected filename.'), 'file, or change the selected filename.'),

View File

@ -2639,11 +2639,23 @@ class WebReportDialog(Report.ReportDialog):
def archive_toggle(self,obj): def archive_toggle(self,obj):
if obj.get_active(): if obj.get_active():
# The .tar.gz box is on
# Set doc label, mark file vs dir, add '.tar.gz' to the path
self.target_fileentry.set_directory_entry(False) self.target_fileentry.set_directory_entry(False)
self.doc_label.set_label("%s:" % _("Filename")) self.doc_label.set_label("%s:" % _("Filename"))
fname = self.target_fileentry.get_full_path(0)
if fname[-7:] != '.tar.gz':
fname = fname + '.tar.gz'
self.target_fileentry.set_filename(fname)
else: else:
# The .tar.gz box is off
# Set doc label, mark dir vs file, remove '.tar.gz' from path
self.target_fileentry.set_directory_entry(True) self.target_fileentry.set_directory_entry(True)
self.doc_label.set_label("%s:" % _("Directory")) self.doc_label.set_label("%s:" % _("Directory"))
fname = self.target_fileentry.get_full_path(0)
if fname[-7:] == '.tar.gz':
fname = fname[:-7]
self.target_fileentry.set_filename(fname)
def setup_paper_frame(self): def setup_paper_frame(self):
pass pass