Author: poeml Date: Fri Sep 17 15:40:37 2010 New Revision: 8129 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8129&view=rev Log: mb edit: - Fix a problem that made it impossible to remove an URL by setting it to an empty string. I am not sure when this sneaked in; that clearly has worked in the past, anyway. r8044 (fix for issue #30) is the likely culprit. Modified: trunk/mb/mb.py Modified: trunk/mb/mb.py URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb.py?rev=8129&r1=8128&r2=8129&view=diff ============================================================================== --- trunk/mb/mb.py (original) +++ trunk/mb/mb.py Fri Sep 17 15:40:37 2010 _at_@ -586,20 +586,29 @@ new_dict = mb.conn.servertext2dict(new) for i in mb.conn.server_editable_attrs: - if not new_dict[i]: + if not old_dict[i] and not new_dict[i]: continue - elif str(old_dict[i]) != new_dict[i]: - print """changing %s from '%s' to '%s'""" \ - % (i, old_dict[i], new_dict[i]) + + if ( old_dict[i] and not new_dict[i] ) or \ + ( str(old_dict[i]) != new_dict[i] ): + + if not new_dict[i]: + print 'unsetting %s (was: %r)' % (i, old_dict[i]) + else: + print 'changing %s from %r to %r' % (i, old_dict[i], new_dict[i]) + a = new_dict[i] if a == 'False': a = False if a == 'True': a = True + if a == None: a = '' if type(getattr(mirror, i)) in [type(1L), type(1), bool]: try: a = int(a) except ValueError: a = 0 setattr(mirror, i, a) + #else: + # print 'unchanged: %s' % i _______________________________________________ mirrorbrain-commits mailing list Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/ Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on Fri Sep 17 2010 - 13:40:39 GMT
This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT