Changeset 230
- Timestamp:
- 19-05-07 12:52:04 (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
-
ChangeLog (modified) (1 diff)
-
moap/command/doap.py (modified) (1 diff)
-
moap/doap/rss.py (modified) (5 diffs)
-
moap/test/Makefile.am (modified) (2 diffs)
-
moap/test/rss/mach.rss.cheetah (added)
-
moap/test/rss/mach.rss.genshi (modified) (1 diff)
-
moap/test/test_commands_doap.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r228 r230 1 2007-05-19 Thomas Vander Stichele <thomas at apestaart dot org> 2 3 * moap/command/doap.py (Rss.do): 4 break into two lines 5 * moap/doap/rss.py (doapsToRss, createdToPubDate, cheetah_toRss): 6 Make the two template language's output as similar as possible. 7 * moap/test/Makefile.am: 8 * moap/test/rss/mach.rss.cheetah: 9 * moap/test/rss/mach.rss.genshi: 10 Add two rss feeds based on the two templating languages. 11 * moap/test/test_commands_doap.py (TestDoapMach.setUp, 12 TestDoapMach.testRssGenshi, TestDoapMach.testRssCheetah): 13 Add tests for the specific template languages. 14 15 Coverage: 72 % ( 844 / 1157) 16 1 17 2007-05-19 Thomas Vander Stichele <thomas at apestaart dot org> 2 18 -
trunk/moap/command/doap.py
r228 r230 412 412 413 413 # FIXME: if one can be found close to the .doap file, use it 414 self.stdout.write(rss.doapsToRss(self.parentCommand.doaps, template, 415 templateType=self._language)) 414 text = rss.doapsToRss(self.parentCommand.doaps, template, 415 templateType=self._language) 416 self.stdout.write(text) 416 417 417 418 class Show(util.LogCommand): -
trunk/moap/doap/rss.py
r228 r230 22 22 @type templateType: str 23 23 @param templateType: cheetah or genshi 24 25 @rtype: str 24 26 """ 25 27 projects = [d.getProject() for d in doaps] … … 50 52 # template language specific templates/handlers 51 53 52 CHEETAH_TEMPLATE = """<rss version="2.0" >54 CHEETAH_TEMPLATE = """<rss version="2.0" lang="en"> 53 55 <channel> 54 56 #set $names = ", ".join([p.name for p in $projects]) … … 61 63 #for $release in $project.release 62 64 #set $v = $release.version 63 <item>64 <title>$project.name $v.revision '$v.name' released</title>65 <guid>$project.shortname-$v.revision</guid>66 <link>release-$project.homepage</link>67 <pubDate>$createdToPubDate($v.created)</pubDate>68 <description>65 <item> 66 <title>$project.name $v.revision '$v.name' released</title> 67 <guid>release-$project.shortname-$v.revision</guid> 68 <link>$project.homepage</link> 69 <pubDate>$createdToPubDate($v.created)</pubDate> 70 <description> 69 71 For more information, visit 70 72 <A HREF="$project.homepage">the project homepage</A> 71 </description> 73 </description> 74 </item> 72 75 #end for 73 76 #end for … … 83 86 template = CHEETAH_TEMPLATE 84 87 85 t = Cheetah.Template.Template(template, searchList={ 88 t = Cheetah.Template.Template(template, searchList=[ 89 { 86 90 'projects': projects, 87 91 'createdToPubDate': createdToPubDate 88 } )89 return t92 }]) 93 return str(t) 90 94 91 95 GENSHI_TEMPLATE = """<rss version="2.0" … … 93 97 lang="en"> 94 98 <channel> 95 <title>${projects[0].name}</title> 99 <title>Release feed for ${projects[0].name}</title> 100 <description>Release feed for ${projects[0].name}</description> 101 <link>${projects[0].homepage}</link> 96 102 <language>en</language> 97 103 98 104 <py:for each="project in projects"> 99 <item py:for="release in project.release">100 <py:with vars="v=release.version;101 n=v.name;102 ">103 <title>${project.name} ${v.revision} '${v.name}' released</title>104 <link>${project.homepage}</link>105 <guid>release-${project.shortname}-${v.revision}</guid>106 <pubdate>${createdToPubDate(v.created)}</pubdate>107 <description>105 <item py:for="release in project.release"> 106 <py:with vars="v=release.version; 107 n=v.name; 108 "> 109 <title>${project.name} ${v.revision} '${v.name}' released</title> 110 <guid>release-${project.shortname}-${v.revision}</guid> 111 <link>${project.homepage}</link> 112 <pubDate>${createdToPubDate(v.created)}</pubDate> 113 <description> 108 114 For more information, visit 109 115 <A HREF="${project.homepage}">the project homepage</A> 110 </description>111 </py:with>112 </item>116 </description> 117 </py:with> 118 </item> 113 119 </py:for> 114 120 -
trunk/moap/test/Makefile.am
r228 r230 21 21 doap/mach.doap \ 22 22 ical/mach.ical \ 23 rss/mach.rss \ 23 rss/mach.rss.cheetah \ 24 rss/mach.rss.genshi \ 24 25 diff/svn_add_one_line.diff \ 25 26 diff/svn_multiple.diff \ … … 32 33 make $* 33 34 34 rss/mach.rss: 35 moap doap -f doap/mach.doap rss > $@ 35 rss/mach.rss.cheetah: 36 moap doap -f doap/mach.doap rss -t cheetah > $@ 37 38 rss/mach.rss.genshi: 39 moap doap -f doap/mach.doap rss -t genshi > $@ -
trunk/moap/test/rss/mach.rss.genshi
r229 r230 1 1 <rss version="2.0" lang="en"> 2 2 <channel> 3 <title>Mach</title> 3 <title>Release feed for Mach</title> 4 <description>Release feed for Mach</description> 5 <link>http://thomas.apestaart.org/projects/mach/</link> 4 6 <language>en</language> 5 <item>6 <title>Mach 0.9.0 'Cambria' released</title>7 <link>http://thomas.apestaart.org/projects/mach/</link>8 <guid>release-mach-0.9.0</guid>9 <pubdate>Fri, 09 Jun 2006 00:00:00 +0000</pubdate>10 <description>7 <item> 8 <title>Mach 0.9.0 'Cambria' released</title> 9 <guid>release-mach-0.9.0</guid> 10 <link>http://thomas.apestaart.org/projects/mach/</link> 11 <pubDate>Fri, 09 Jun 2006 00:00:00 +0000</pubDate> 12 <description> 11 13 For more information, visit 12 14 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 13 </description>14 </item><item>15 <title>Mach 0.4.9 'China' released</title>16 <link>http://thomas.apestaart.org/projects/mach/</link>17 <guid>release-mach-0.4.9</guid>18 <pubdate>Sat, 08 Apr 2006 00:00:00 +0000</pubdate>19 <description>15 </description> 16 </item><item> 17 <title>Mach 0.4.9 'China' released</title> 18 <guid>release-mach-0.4.9</guid> 19 <link>http://thomas.apestaart.org/projects/mach/</link> 20 <pubDate>Sat, 08 Apr 2006 00:00:00 +0000</pubDate> 21 <description> 20 22 For more information, visit 21 23 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 22 </description>23 </item><item>24 <title>Mach 0.4.8 'More Than One' released</title>25 <link>http://thomas.apestaart.org/projects/mach/</link>26 <guid>release-mach-0.4.8</guid>27 <pubdate>Mon, 21 Nov 2005 00:00:00 +0000</pubdate>28 <description>24 </description> 25 </item><item> 26 <title>Mach 0.4.8 'More Than One' released</title> 27 <guid>release-mach-0.4.8</guid> 28 <link>http://thomas.apestaart.org/projects/mach/</link> 29 <pubDate>Mon, 21 Nov 2005 00:00:00 +0000</pubDate> 30 <description> 29 31 For more information, visit 30 32 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 31 </description>32 </item><item>33 <title>Mach 0.4.7 'Long Time No See' released</title>34 <link>http://thomas.apestaart.org/projects/mach/</link>35 <guid>release-mach-0.4.7</guid>36 <pubdate>Sun, 03 Jul 2005 00:00:00 +0000</pubdate>37 <description>33 </description> 34 </item><item> 35 <title>Mach 0.4.7 'Long Time No See' released</title> 36 <guid>release-mach-0.4.7</guid> 37 <link>http://thomas.apestaart.org/projects/mach/</link> 38 <pubDate>Sun, 03 Jul 2005 00:00:00 +0000</pubDate> 39 <description> 38 40 For more information, visit 39 41 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 40 </description>41 </item><item>42 <title>Mach 0.4.6 'Lenrek' released</title>43 <link>http://thomas.apestaart.org/projects/mach/</link>44 <guid>release-mach-0.4.6</guid>45 <pubdate>Tue, 08 Feb 2005 00:00:00 +0000</pubdate>46 <description>42 </description> 43 </item><item> 44 <title>Mach 0.4.6 'Lenrek' released</title> 45 <guid>release-mach-0.4.6</guid> 46 <link>http://thomas.apestaart.org/projects/mach/</link> 47 <pubDate>Tue, 08 Feb 2005 00:00:00 +0000</pubDate> 48 <description> 47 49 For more information, visit 48 50 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 49 </description>50 </item><item>51 <title>Mach 0.4.5 'Snow' released</title>52 <link>http://thomas.apestaart.org/projects/mach/</link>53 <guid>release-mach-0.4.5</guid>54 <pubdate>Thu, 18 Mar 2004 00:00:00 +0000</pubdate>55 <description>51 </description> 52 </item><item> 53 <title>Mach 0.4.5 'Snow' released</title> 54 <guid>release-mach-0.4.5</guid> 55 <link>http://thomas.apestaart.org/projects/mach/</link> 56 <pubDate>Thu, 18 Mar 2004 00:00:00 +0000</pubDate> 57 <description> 56 58 For more information, visit 57 59 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 58 </description>59 </item><item>60 <title>Mach 0.4.4 'Madrid' released</title>61 <link>http://thomas.apestaart.org/projects/mach/</link>62 <guid>release-mach-0.4.4</guid>63 <pubdate>Thu, 11 Mar 2004 00:00:00 +0000</pubdate>64 <description>60 </description> 61 </item><item> 62 <title>Mach 0.4.4 'Madrid' released</title> 63 <guid>release-mach-0.4.4</guid> 64 <link>http://thomas.apestaart.org/projects/mach/</link> 65 <pubDate>Thu, 11 Mar 2004 00:00:00 +0000</pubDate> 66 <description> 65 67 For more information, visit 66 68 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 67 </description>68 </item><item>69 <title>Mach 0.4.3 'Hot Water' released</title>70 <link>http://thomas.apestaart.org/projects/mach/</link>71 <guid>release-mach-0.4.3</guid>72 <pubdate>Tue, 16 Dec 2003 00:00:00 +0000</pubdate>73 <description>69 </description> 70 </item><item> 71 <title>Mach 0.4.3 'Hot Water' released</title> 72 <guid>release-mach-0.4.3</guid> 73 <link>http://thomas.apestaart.org/projects/mach/</link> 74 <pubDate>Tue, 16 Dec 2003 00:00:00 +0000</pubDate> 75 <description> 74 76 For more information, visit 75 77 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 76 </description>77 </item><item>78 <title>Mach 0.4.2 'No More Betas' released</title>79 <link>http://thomas.apestaart.org/projects/mach/</link>80 <guid>release-mach-0.4.2</guid>81 <pubdate>Tue, 21 Oct 2003 00:00:00 +0000</pubdate>82 <description>78 </description> 79 </item><item> 80 <title>Mach 0.4.2 'No More Betas' released</title> 81 <guid>release-mach-0.4.2</guid> 82 <link>http://thomas.apestaart.org/projects/mach/</link> 83 <pubDate>Tue, 21 Oct 2003 00:00:00 +0000</pubDate> 84 <description> 83 85 For more information, visit 84 86 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 85 </description>86 </item><item>87 <title>Mach 0.4.1 'Get A Room' released</title>88 <link>http://thomas.apestaart.org/projects/mach/</link>89 <guid>release-mach-0.4.1</guid>90 <pubdate>Fri, 10 Oct 2003 00:00:00 +0000</pubdate>91 <description>87 </description> 88 </item><item> 89 <title>Mach 0.4.1 'Get A Room' released</title> 90 <guid>release-mach-0.4.1</guid> 91 <link>http://thomas.apestaart.org/projects/mach/</link> 92 <pubDate>Fri, 10 Oct 2003 00:00:00 +0000</pubDate> 93 <description> 92 94 For more information, visit 93 95 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 94 </description>95 </item><item>96 <title>Mach 0.4.0 'Barcelona' released</title>97 <link>http://thomas.apestaart.org/projects/mach/</link>98 <guid>release-mach-0.4.0</guid>99 <pubdate>Mon, 08 Sep 2003 00:00:00 +0000</pubdate>100 <description>96 </description> 97 </item><item> 98 <title>Mach 0.4.0 'Barcelona' released</title> 99 <guid>release-mach-0.4.0</guid> 100 <link>http://thomas.apestaart.org/projects/mach/</link> 101 <pubDate>Mon, 08 Sep 2003 00:00:00 +0000</pubDate> 102 <description> 101 103 For more information, visit 102 104 <A HREF="http://thomas.apestaart.org/projects/mach/">the project homepage</A> 103 </description>104 </item>105 </description> 106 </item> 105 107 </channel> 106 108 </rss> -
trunk/moap/test/test_commands_doap.py
r228 r230 17 17 self.ical = os.path.join(os.path.dirname(__file__), 'ical', 18 18 'mach.ical') 19 self.rss = os.path.join(os.path.dirname(__file__), 'rss', 20 'mach.rss') 19 self.grss = os.path.join(os.path.dirname(__file__), 'rss', 20 'mach.rss.genshi') 21 self.crss = os.path.join(os.path.dirname(__file__), 'rss', 22 'mach.rss.cheetah') 21 23 self.stdout = StringIO.StringIO() 22 24 self.command = doap.Doap(stdout=self.stdout) … … 27 29 self.assertEquals(self.stdout.getvalue(), ref) 28 30 29 def testRss (self):31 def testRssGenshi(self): 30 32 ret = self.command.parse(['-f', self.doap, 'rss']) 31 ref = open(self.rss).read() 33 ref = open(self.grss).read() 34 self.assertEquals(self.stdout.getvalue(), ref) 35 36 def testRssCheetah(self): 37 ret = self.command.parse(['-f', self.doap, 'rss', '-t', 'cheetah']) 38 ref = open(self.crss).read() 32 39 self.assertEquals(self.stdout.getvalue(), ref) 33 40
Note: See TracChangeset
for help on using the changeset viewer.
