Merge lp:~bratdaking/backintime/bug-423086 into lp:backintime/1.0

Proposed by Bart de Koning
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bratdaking/backintime/bug-423086
Merge into: lp:backintime/1.0
Diff against target: 112 lines
4 files modified
CHANGES (+1/-0)
common/config.py (+12/-2)
common/snapshots.py (+10/-1)
gnome/app.py (+4/-2)
To merge this branch: bzr merge lp:~bratdaking/backintime/bug-423086
Reviewer Review Type Date Requested Status
Back In Time Team Pending
Review via email: mp+13504@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Bart de Koning (bratdaking) wrote :

This branch contains a check whether there is write access to the snapshots folder, and more info is added to the info file, to facilitate future ideas

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGES'
2--- CHANGES 2009-10-15 01:35:38 +0000
3+++ CHANGES 2009-10-16 21:00:28 +0000
4@@ -13,6 +13,7 @@
5 * fix exclude patterns in KDE4 (LP:#432537)
6 * fix opening german files with external applications in KDE (LP: #404652)
7 * changed default exclude patterns to caches, thumbnails, trashbins, and backups (LP: #422132)
8+* write access to snapshot folder is checked & change to snapshot version 2 (LP: #423086)
9 * fix small bugs
10 * Fix bug in schedule per included folder (LP: #412470)
11 * Used a more standard crontab syntax (LP: #409783)
12
13=== modified file 'common/config.py'
14--- common/config.py 2009-10-15 01:35:38 +0000
15+++ common/config.py 2009-10-16 21:00:28 +0000
16@@ -194,6 +194,7 @@
17 return os.path.join( self.get_snapshots_path( profile_id ), 'backintime' )
18
19 def set_snapshots_path( self, value, profile_id = None ):
20+ """Sets the snapshot path to value, initializes, and checks it"""
21 if len( value ) <= 0:
22 return False
23
24@@ -201,13 +202,22 @@
25 self.notify_error( _( '%s is not a folder !' ) )
26 return False
27
28+ #Initialize the snapshots folder
29 full_path = os.path.join( value, 'backintime' )
30 if not os.path.isdir( full_path ):
31 tools.make_dirs( full_path )
32 if not os.path.isdir( full_path ):
33- self.notify_error( _( 'Can\'t write to: %s\nAre you sure have write access ?' ) )
34+ self.notify_error( _( 'Can\'t write to: %s\nAre you sure you have write access ?' % value ) )
35 return False
36-
37+
38+ #Test write access for the folder
39+ check_path = os.path.join( full_path, 'check' )
40+ tools.make_dirs( check_path )
41+ if not os.path.isdir( check_path ):
42+ self.notify_error( _( 'Can\'t write to: %s\nAre you sure you have write access ?' % full_path ) )
43+ return False
44+
45+ os.rmdir( check_path )
46 self.set_profile_str_value( 'snapshots.path', value, profile_id )
47 return True
48
49
50=== modified file 'common/snapshots.py'
51--- common/snapshots.py 2009-10-14 20:54:05 +0000
52+++ common/snapshots.py 2009-10-16 21:00:28 +0000
53@@ -26,6 +26,7 @@
54 import bz2
55 import pwd
56 import grp
57+import socket
58
59 import config
60 import configfile
61@@ -731,8 +732,16 @@
62 fileinfo.close()
63
64 #create info file
65+ logger.info( "Create info file" )
66+ machine = socket.gethostname()
67+ user = os.environ['LOGNAME']
68+ profile_id = self.config.get_current_profile()
69 info_file = configfile.ConfigFile()
70- info_file.set_int_value( 'snapshot_version', 1 )
71+ info_file.set_int_value( 'snapshot_version', 2 )
72+ info_file.set_str_value( 'snapshot_date', snapshot_id )
73+ info_file.set_str_value( 'snapshot_machine', machine )
74+ info_file.set_str_value( 'snapshot_user', user )
75+ info_file.set_int_value( 'snapshot_profile_id', profile_id )
76 info_file.save( self.get_snapshot_info_path( new_snapshot_id ) )
77 info_file = None
78
79
80=== modified file 'gnome/app.py'
81--- gnome/app.py 2009-10-15 15:28:29 +0000
82+++ gnome/app.py 2009-10-16 21:00:28 +0000
83@@ -311,7 +311,7 @@
84 gobject.timeout_add( 1000, self.update_backup_info )
85
86 def on_combo_profiles_changed( self, *params ):
87- if self.disable_combo_changed:
88+ if self.disable_combo_changed:
89 return
90
91 iter = self.combo_profiles.get_active_iter()
92@@ -329,10 +329,11 @@
93 self.update_all( first_update_all )
94
95 def update_profiles( self ):
96+ """Populates the profile list"""
97 self.disable_combo_changed = True
98
99 profiles = self.config.get_profiles_sorted_by_name()
100-
101+
102 select_iter = None
103 self.store_profiles.clear()
104
105@@ -893,6 +894,7 @@
106
107 if snapshots_path != self.config.get_snapshots_path() or include_folders != self.config.get_include_folders():
108 self.update_all( False )
109+ self.update_profiles()
110
111 def on_btn_snapshot_name_clicked( self, button ):
112 iter = self.list_time_line.get_selection().get_selected()[1]

Subscribers

People subscribed via source and target branches