Merge lp:~jerith/renamer/empty-config-lines into lp:renamer

Proposed by Jeremy Thurgood
Status: Merged
Approved by: Tristan Seligmann
Approved revision: 83
Merged at revision: 83
Proposed branch: lp:~jerith/renamer/empty-config-lines
Merge into: lp:renamer
Diff against target: 11 lines (+2/-0)
1 file modified
renamer/plugin.py (+2/-0)
To merge this branch: bzr merge lp:~jerith/renamer/empty-config-lines
Reviewer Review Type Date Requested Status
Tristan Seligmann Approve
Review via email: mp+30313@code.launchpad.net

Description of the change

No test updates, because there aren't any around this code.

To post a comment you must log in.
Revision history for this message
Tristan Seligmann (mithrandi) wrote :

Since everything probably wants to operate on a stripped line, how about doing "line = line.strip()" instead of stripping it everywhere it's used?

Also, this is out of scope for this branch, but since it's a trivial change, how about skipping lines when line.startswith('#')?

review: Needs Fixing
Revision history for this message
Jeremy Thurgood (jerith) wrote :

I considered both of those, but rather than adding any more (even trivial) complexity, I'd prefer to replace the parser completely.

If I do the stripping, I'd prefer to do it after the split (so as to allow more natural setting of variables), but at that point we should probably use something like ConfigParser instead of the fragile splitting of lines we have now.

Revision history for this message
Tristan Seligmann (mithrandi) wrote :

If we're planning to replace the parser, then sure, let's not bother with any more work here; but please file a bug report about replacing the parser in that case.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'renamer/plugin.py'
2--- renamer/plugin.py 2009-05-03 19:37:09 +0000
3+++ renamer/plugin.py 2010-07-19 18:08:44 +0000
4@@ -68,6 +68,8 @@
5 config = {}
6 if fd is not None:
7 for line in fd:
8+ if not line.strip():
9+ continue
10 key, value = line.strip().split('=', 1)
11 config[key] = value
12

Subscribers

People subscribed via source and target branches