Changeset 6427
- Timestamp:
- 08/20/08 15:41:49 (5 months ago)
- Location:
- Trunk/association/services/pluginLibrary
- Files:
-
- 13 added
- 4 modified
-
TODO (modified) (2 diffs)
-
aggregator.py (modified) (3 diffs)
-
dirScraper.py (modified) (3 diffs)
-
repos.lst (modified) (1 diff)
-
test (added)
-
test/bar (added)
-
test/bar/adipisicing (added)
-
test/bar/amet (added)
-
test/bar/consectetur (added)
-
test/bar/elit (added)
-
test/bar/includeLibrary.txt (added)
-
test/foo (added)
-
test/foo/dolor (added)
-
test/foo/excludeLibrary.txt (added)
-
test/foo/ipsum (added)
-
test/foo/lorem (added)
-
test/foo/sit (added)
Legend:
- Unmodified
- Added
- Removed
-
Trunk/association/services/pluginLibrary/TODO
r6301 r6427 1 1 == Aggregator == 2 2 3 * 404 handling4 * SVN black-/whitelist handling3 * SVN black-/whitelisting: wildcards support 4 * logging 5 5 * handling of removed plugins (e.g. don't delete, but tag with "disabled"?) 6 6 * efficiency enhancements (e.g. caching, deferred processing) 7 * logging8 7 9 8 == Search == … … 47 46 * serializers 48 47 * search 48 49 == Misc. == 50 51 * code sanitizing 52 * refactoring -
Trunk/association/services/pluginLibrary/aggregator.py
r6377 r6427 72 72 empty = "<html><body><div id='storeArea'>\n</div></body></html>" # XXX: ugly hack; cf. tiddlywiki.TiddlyWiki.getPluginTiddlers() 73 73 if plugins != empty: 74 store.delete(bag) # XXX: ugly hack? 75 store.put(bag) 74 savePlugins(store, bag) 76 75 import_wiki(plugins, bag.name) 77 76 return True … … 83 82 plugins = svn.getPlugins("./", True) 84 83 if plugins: 85 store.delete(bag) # XXX: ugly hack? 86 store.put(bag) 84 savePlugins(store, bag) 87 85 for plugin in plugins: 88 86 plugin.bag = bag.name … … 109 107 store.put(recipe) 110 108 109 def savePlugins(store, bag): 110 """ 111 save repository's plugins to store 112 113 @param bags: TiddlyWeb bag 114 @type bags: Bag 115 @param store: TiddlyWeb store 116 @type store: Store 117 @return: None 118 """ 119 try: # XXX: don't use exception here!? 120 store.delete(bag) # XXX: ugly hack? 121 except IOError: 122 pass 123 store.put(bag) 124 111 125 # startup 112 126 -
Trunk/association/services/pluginLibrary/dirScraper.py
r6377 r6427 19 19 """ 20 20 self.host = addTrailingSlash(host) 21 self.blacklist = "excludeLibrary.txt" 22 self.whitelist = "includeLibrary.txt" 21 23 22 24 def _get(self, url): … … 37 39 retrieve .js files from directory 38 40 41 if there is a whitelist file, only those items will be retrieved 42 if there is a blacklist file, those items will be excluded 43 whitelist and blacklist files contain one file or directory name per line 44 whitelist takes precedence over blacklist 45 39 46 @param dir: directory (relative path) 40 47 @type dir: str … … 50 57 list = soup.find("ul") 51 58 items = list.findChildren("li") 52 for item in items: 53 anchor = item.findChild("a") 54 href = anchor["href"] 55 if href == "../": 59 uris = [item.findChild("a")["href"] for item in items] 60 if self.whitelist in uris: 61 whitelisted = self._get(self.host + dir + self.whitelist).split("\n") 62 uris = [uri.strip() for uri in whitelisted] # XXX: do not strip whitespace!? 63 elif self.blacklist in uris: 64 blacklisted = self._get(self.host + dir + self.blacklist).split("\n") 65 uris = [uri.strip() for uri in uris if uri not in blacklisted] # XXX: do not strip whitespace!? 66 for uri in uris: 67 if uri == "../": 56 68 continue 57 if href.endswith(".js"): # plugin69 if uri.endswith(".js"): # plugin 58 70 plugin = Tiddler() 59 plugin.title = posixpath.basename( href[:-3])71 plugin.title = posixpath.basename(uri[:-3]) 60 72 plugin.tags = "systemConfig" # XXX: should be list; cf. aggregator.getPlugins() 61 plugin.text = self._get(self.host + dir + href)73 plugin.text = self._get(self.host + dir + uri) 62 74 plugins.append(plugin) 63 elif href.endswith("/") and recursive: # directory64 plugins.extend(self.getPlugins(dir + href))75 elif uri.endswith("/") and recursive: # directory -- XXX: potential for infinite loop? 76 plugins.extend(self.getPlugins(dir + uri)) 65 77 return plugins 66 78 -
Trunk/association/services/pluginLibrary/repos.lst
r6377 r6427 4 4 #http://www.tiddlytools.com | TiddlyWiki | TiddlyTools 5 5 #http://devpad.tiddlyspot.com | TiddlyWiki | FND's DevPad 6 http://svn.tiddlywiki.org/Trunk/association/plugins | SVN | Community Plugins 6 #http://svn.tiddlywiki.org/Trunk/association/plugins | SVN | Community Plugins 7 8 http://svn.tiddlywiki.org/Trunk/association/pluginLibrary/test | SVN | Test
