aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/comment.py
Commit message (Collapse)AuthorAgeFilesLines
* Minor fixes to get unittests working again.W. Trevor King2009-07-121-2/+1
|
* Added be-mbox-to-xml.W. Trevor King2009-07-121-5/+19
| | | | | | | | | | | | | | | | | | | | | | | Reworked to allow "be comment" to handle unicode strings (see bug e4ed63f6-9000-4d0b-98c3-487269140141). The solution was to escape all the unicode to produce and ASCII string before calling ElementTree.XML, and then converting back to unicode afterwards. Added a unicode-containing comment to the end of bug f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a so that there's a handy unicode comment for testing. XML headers (e.g. '<?xml version="1.0" encoding="UTF-8" ?>') are now added to all xml output from be. Switched non-text/* encoding library to base64 instead of email.encoders, which makes that code in libbe/comment.py simpler. Changed libbe/mapfile.py error encoding from string_escape to unicode_escape so it can handle unicode. Everything's still untested, and be-xml-to-mbox doesn't handle unicode yet, but I felt this commit was getting a bit unwieldy ;).
* "be comment --xml" now translates comment uuids to alt_ids.W. Trevor King2009-07-111-1/+1
|
* Adjustments to new versioned_property behavior.W. Trevor King2009-07-111-9/+30
| | | | | Also adjusted libbe/comment.py to move to user-specified alt_ids, rather than uuids.
* seems to work ;)W. Trevor King2009-07-101-19/+67
|
* Updated copyright blurbs and AUTHORS and included script for future updatesW. Trevor King2009-07-011-1/+3
|
* Added ability to handle non text/* MIME types.W. Trevor King2009-06-261-4/+18
| | | | | | | | | | | | | | | | The main problem was the encoding/decoding that was happening to _all_ input/output. Now many I/O activities have a `binary' option to disable any encoding/decoding. The `binary' flag is set whenever the comment content-type is not a text/* type. In order to print valid XML (and make life easy on xml/be-xml-to-mbox), non text/* types are printed out as base64-encoded MIME messages, so be list --xml | be-xml-to-mbox | catmutt works as you'd expect. With the standard (non-XML) output from `be show', we just print a message telling the user that we can't reasonably display the MIME type and that they should use the XML output if they want to see it.
* Added Bug.extra_strings to support add-on functionality, e.g. `be tag`.W. Trevor King2009-06-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Versioned properties whose data is a mutable type are tricky, since the simple comparisons we'd been using in libbe.properties.change_hook_property don't work for mutables. For now, we avoid that problem by assuming a change happened whenever a mutable property is set. change_hook_property is a bit untidy at the moment while I work out how to deal with mutables. As an example of using Bug.extra_strings to patch on some useful functionality, I've written becommands/tag.py. I'd suggest future add-ons (e.g. becommands/depend.py?) use the "<LABEL>:<value>" string format to keep it easy to sort out which strings belong to which add-ons. tag.py is still missing command line tag-removal and tag-searching for `be list'. Perhaps something like be list --extra-strings TAG:<your-tag>,TAG:<another-tag>,DEPEND:<bug-id> would be good, although it would requre escaping commas from the tags, or refusing to allow commas in the tags... libbe.properties.ValueCheckError also got a minor update so the printed error message makes sense when raised with allowed being an iterable (i.e. check_property) or a function (e.g. fn_checked_property). All of this digging around turned up a really buggy libbe.bugdir.MultipleBugMatches. Obviously I had never actually called it before :p. Should be fixed now. libbe.comment._set_comment_body has also been normalized to match the suggested change_hook interface: change_hook(self, old, new). Although, I'm not sure why it hadn't been causing obvious problems before, so maybe I'm misunderstanding something about that.
* Use Comment.content_type in xml output.W. Trevor King2009-06-221-0/+2
|
* Escape XML strings.W. Trevor King2009-06-221-10/+12
| | | | | | Since <creator>John Doe <jdoe@example.com></creator> is not valid XML.
* Fixed libbe.settings_object.EMPTY output in bug/comment XML.W. Trevor King2009-06-221-1/+1
| | | | The xml() method hadn't been updated since the settings_object revamp.
* Adjusted comment XML fields for consistency.W. Trevor King2009-06-221-4/+4
| | | | | Renamed "name" -> "short-name" and "in_reply_to" -> "in-reply-to". Reordered uuid before short-name.
* Merged Thomas Habets 2009-01-07 XML output for "be show".W. Trevor King2009-06-191-3/+48
|\ | | | | | | | | | | | | | | | | | | | | | | I rewrote a few of his routines, e.g. generalizing Comment.string_thread to run a caller-specified method avoided the need for some duplicate code in Comment.xml_thread. There was also a reasonable reorganization of libbe.settings_object.versioned_property because the <in_reply_to> field of the Comment.xml output was giving me `-1' (= old settings_object.EMPTY) instead of None, even after I had set comm.in_reply_to to None. The rewritten versioned_property avoids the ambiguity of UNPRIMED vs EMPTY, and avoids the stupididy of my using EMPTY=-1 ;).
| * XML output for "be show"Thomas Habets2009-01-071-0/+31
| |
* | Fixed missing directory error when merging comments onto a bare bug.W. Trevor King2008-12-041-0/+2
| | | | | | | | | | | | | | | | | | If bug_A had no comments (and so, no comment directory), changing comment settings before saving raised missing directory errors. save_settings had previously assumed the .be/bugs/XYZ/comments/ directory existed, which wasn't true for comment-less bugs. Now it checks, and creates the directory if necessary.
* | Converted Comment to the settings_object system.W. Trevor King2008-12-021-56/+28
| |
* | Added decorator-style properties to bugdir. Created settings_object module.W. Trevor King2008-12-021-1/+1
| | | | | | | | | | | | | | | | settings_object.SavedSettingsObject encapsulates some of the common settings functionality in the BE BugDir, Bug, and Comment classes. It's a bit awkward due to the nature of scoping in python subclasses, but it's better than reproducing this code in each of the above classes. Now I need to move Bug and Comment over to *this* system ;).
* | Added decorator-style properties to libbe/comment.py.W. Trevor King2008-12-011-66/+162
| | | | | | | | | | Also some typo corrections and some reworking of bug/bugdir to better support the lazier loading.
* | Added becommands/comment completion.W. Trevor King2008-11-271-2/+4
| |
* | Added -a/n/m/r to becommands/diff.py.W. Trevor King2008-11-251-2/+2
| |
* | Added libbe/encoding.py to wrap input/output/file access appropriately.W. Trevor King2008-11-251-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I borrowed most of the code for this. get_encoding() is from Trac http://trac.edgewall.org/browser/trunk/trac/util/datefmt.py format_datetime() Trac has a BSD license http://trac.edgewall.org/wiki/TracLicense I don't know if such a small snippet requires us to "reproduce the above copyright" or where we need to reproduce it if it is needed. The stdout/stdin replacement code follows http://wiki.python.org/moin/ShellRedirectionFails Because of the stdout replacement, the doctests executes now need an optional 'test' argument to turn off replacement during the doctests, otherwise doctest flips out (since it had set up stdout to catch output, and then we clobbered it's setup). References: http://wiki.python.org/moin/Unicode http://www.amk.ca/python/howto/unicode http://www.python.org/dev/peps/pep-0100/ I also split libbe/editor.py off from libbe.utility.py and started explaining the motivation for the BugDir init flags in it's docstring.
* | Added becommands/merge to join duplicate bugs.W. Trevor King2008-11-241-6/+13
|/
* Fixed broken doctest and inconsitent indentation from not wrapping comments.W. Trevor King2008-11-241-2/+4
| | | | | Also emptied becommands/__init__.py. I didn't understand the plugin interface when I wrote it.
* Removed auto-wrapping from comment.Comment.string().W. Trevor King2008-11-241-2/+4
| | | | | | | | | | It makes tracebacks almost illegible. I doubt markup/markdown systax or auto-formatting is really useful, since bugs-reports are ususally a short comment and a traceback. I also closed a4d38ba7-ec28-4096-a4f3-eb8c9790ffb2 and 7bfc591e-584a-476e-8e11-b548f1afcaa6, which have probably been fixed for a long time...
* Added 'allow_no_rcs' flag to RCS file system access methods.W. Trevor King2008-11-241-1/+1
| | | | | Now mapfile access has fewer special cases, and there is less redundant rcs.add/update code.
* Go back to lazy bug loading to get execution speed back up.W. Trevor King2008-11-231-7/+7
| | | | Fixes bug b3c6da51-3a30-42c9-8c75-587c7a1705c5
* Added archive/project init code for `./test_usage.sh arch`.W. Trevor King2008-11-231-1/+1
| | | | Also some minor cleanups.
* Oops, these new submods are used by the new, classified Bug & BugDir.W. Trevor King2008-11-221-0/+382
I'd forgotten tell bzr...