Merge lp:~jml/pkgme/format-description into lp:pkgme
Status: | Merged |
---|---|
Approved by: | James Westby |
Approved revision: | 103 |
Merged at revision: | 94 |
Proposed branch: | lp:~jml/pkgme/format-description |
Merge into: | lp:pkgme |
Diff against target: |
195 lines (+164/-0) 2 files modified
pkgme/info_elements.py (+49/-0) pkgme/tests/test_info_elements.py (+115/-0) |
To merge this branch: | bzr merge lp:~jml/pkgme/format-description |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Westby | Approve | ||
Review via email: mp+86558@code.launchpad.net |
Commit message
Auto-format description when it doesn't appear to be correctly formatted.
Description of the change
Gives Description powers of automatically formatting incoming descriptions so they fit into the Debian control file.
Implementation has been guided by http://
In distinguishing between auto-formatted descriptions and ones that we leave alone, I felt it appropriate to add error checking for the ones we leave as-is. This means that callers of Description.clean() can rely on getting a proper description.
I'm raising user-friendly errors when the description is invalid, but I'm not 100% sure whether there would be a more appropriate way of raising them.
As an alternative strategy, when we find errors we could instead go back and treat the whole string as one that needs auto-formatting.
Hi,
I think this test shows undesirable behaviour:
162 + def test_non_ indented_ further_ lines(self) :
In the binary backend we're going to want to take the description from MyApps
and hand it over to this code.
If the developer enters a space at the start of the first line then it will
error, and there's nothing we can do except lstrip() the description.
I think that a better check for whether to act on it is whether there is
a space at the start of every line. You would still get in to trouble if
the developer put a space at the start of every line but left blank lines,
but that will be rarer.
I think this is what you meant by
As an alternative strategy, when we find errors we could instead go back and treat the whole string as one that needs auto-formatting.
but I'm of course willing to be convinced otherwise.
Thanks,
James