Rev 2442: Add get_help_text() to RegisteredTopic to get the help as a string. in file:///home/robertc/source/baz/help-contexts/

Robert Collins robertc at robertcollins.net
Fri Apr 20 02:07:53 BST 2007


At file:///home/robertc/source/baz/help-contexts/

------------------------------------------------------------
revno: 2442
revision-id: robertc at robertcollins.net-20070420010751-mghuh1ac3ce1ovhl
parent: robertc at robertcollins.net-20070420005034-4z8nhh9x6nml05j2
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Fri 2007-04-20 11:07:51 +1000
message:
  Add get_help_text() to RegisteredTopic to get the help as a string.
modified:
  bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
  bzrlib/tests/test_help.py      test_help.py-20070419045354-6q6rq15j9e2n5fna-1
=== modified file 'bzrlib/help_topics.py'
--- a/bzrlib/help_topics.py	2007-04-20 00:45:17 +0000
+++ b/bzrlib/help_topics.py	2007-04-20 01:07:51 +0000
@@ -275,3 +275,7 @@
         :param topic: The name of the topic that this represents.
         """
         self.topic = topic
+
+    def get_help_text(self):
+        """Return a string with the help for this topic."""
+        return topic_registry.get_detail(self.topic)

=== modified file 'bzrlib/tests/test_help.py'
--- a/bzrlib/tests/test_help.py	2007-04-20 00:45:17 +0000
+++ b/bzrlib/tests/test_help.py	2007-04-20 01:07:51 +0000
@@ -54,6 +54,12 @@
         topic = help_topics.RegisteredTopic('basic')
         self.assertEqual('basic', topic.topic)
 
+    def test_get_help_text(self):
+        """A RegisteredTopic returns the get_detail results for get_help_text."""
+        topic = help_topics.RegisteredTopic('commands')
+        self.assertEqual(help_topics.topic_registry.get_detail('commands'),
+            topic.get_help_text())
+
 
 class TestTopicContext(tests.TestCase):
     """Tests for the HelpTopicContext class."""



More information about the bazaar-commits mailing list