Merge lp:~stefanor/ibid/botdir-data into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Stefano Rivera
Status: Merged
Approved by: Michael Gorven
Approved revision: 883
Merged at revision: 884
Proposed branch: lp:~stefanor/ibid/botdir-data
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 162 lines (+28/-17)
6 files modified
ibid/config.py (+2/-2)
ibid/plugins/meetings.py (+1/-1)
ibid/plugins/urlgrab.py (+7/-9)
ibid/source/http.py (+5/-4)
ibid/utils/__init__.py (+12/-0)
scripts/ibid-plugin (+1/-1)
To merge this branch: bzr merge lp:~stefanor/ibid/botdir-data
Reviewer Review Type Date Requested Status
Michael Gorven Approve
Keegan Carruthers-Smith Approve
Jonathan Hitchcock Approve
Review via email: mp+18750@code.launchpad.net

This proposal supersedes a proposal from 2010-02-06.

To post a comment you must log in.
Revision history for this message
Jonathan Hitchcock (vhata) :
review: Approve
Revision history for this message
Keegan Carruthers-Smith (keegan-csmith) wrote :

Looks good. I am not that familiar with ibid core, but i was wondering what would happen if we were running ibid from an egg. Would stuff like this break? (My guess is no since you will use defaultish type values)

review: Approve
Revision history for this message
Stefano Rivera (stefanor) wrote :

> (My guess is no since you will use defaultish type values)

At the moment, ibid isn't eggable

Revision history for this message
Michael Gorven (mgorven) wrote :

 review approve
 status approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ibid/config.py'
--- ibid/config.py 2010-01-17 20:17:23 +0000
+++ ibid/config.py 2010-02-06 10:03:13 +0000
@@ -5,9 +5,9 @@
55
6from configobj import ConfigObj6from configobj import ConfigObj
7from validate import Validator7from validate import Validator
8from pkg_resources import resource_stream
98
10import ibid9import ibid
10from ibid.utils import locate_resource
1111
12def monkeypatch(self, name):12def monkeypatch(self, name):
13 if self.has_key(name):13 if self.has_key(name):
@@ -17,7 +17,7 @@
17ConfigObj.__getattr__ = monkeypatch17ConfigObj.__getattr__ = monkeypatch
1818
19def FileConfig(filename):19def FileConfig(filename):
20 spec = resource_stream(__name__, 'configspec.ini')20 spec = file(locate_resource('ibid', 'configspec.ini'), 'r')
21 configspec = ConfigObj(spec, list_values=False, encoding='utf-8')21 configspec = ConfigObj(spec, list_values=False, encoding='utf-8')
22 config = ConfigObj(filename, configspec=configspec, interpolation='Template', encoding='utf-8')22 config = ConfigObj(filename, configspec=configspec, interpolation='Template', encoding='utf-8')
23 config.validate(Validator())23 config.validate(Validator())
2424
=== modified file 'ibid/plugins/meetings.py'
--- ibid/plugins/meetings.py 2010-01-18 23:20:33 +0000
+++ ibid/plugins/meetings.py 2010-02-06 10:03:13 +0000
@@ -17,12 +17,12 @@
17from ibid.compat import json17from ibid.compat import json
18from ibid.config import BoolOption, IntOption, Option18from ibid.config import BoolOption, IntOption, Option
19from ibid.plugins import Processor, match, authorise19from ibid.plugins import Processor, match, authorise
20from ibid.source.http import templates
20from ibid.utils import format_date, plural21from ibid.utils import format_date, plural
2122
22help = {}23help = {}
23log = logging.getLogger('plugins.meetings')24log = logging.getLogger('plugins.meetings')
2425
25templates = Environment(loader=PackageLoader('ibid', 'templates'))
26meetings = {}26meetings = {}
2727
28help['meeting'] = u'Take minutes of an IRC Meeting'28help['meeting'] = u'Take minutes of an IRC Meeting'
2929
=== modified file 'ibid/plugins/urlgrab.py'
--- ibid/plugins/urlgrab.py 2010-01-25 09:23:49 +0000
+++ ibid/plugins/urlgrab.py 2010-02-06 10:03:13 +0000
@@ -8,13 +8,12 @@
8import logging8import logging
9import re9import re
1010
11from pkg_resources import resource_exists, resource_stream
12
13import ibid11import ibid
14from ibid.plugins import Processor, handler12from ibid.plugins import Processor, handler
15from ibid.config import Option13from ibid.config import Option
16from ibid.db import IbidUnicode, IbidUnicodeText, Integer, DateTime, \14from ibid.db import IbidUnicode, IbidUnicodeText, Integer, DateTime, \
17 Table, Column, ForeignKey, Base, VersionedSchema15 Table, Column, ForeignKey, Base, VersionedSchema
16from ibid.utils import locate_resource
18from ibid.utils.html import get_html_parse_tree17from ibid.utils.html import get_html_parse_tree
1918
20help = {}19help = {}
@@ -61,13 +60,12 @@
61 'delicious')60 'delicious')
6261
63 def setup(self):62 def setup(self):
64 if resource_exists(__name__, '../data/tlds-alpha-by-domain.txt'):63 tldfile = locate_resource('ibid', 'data/tlds-alpha-by-domain.txt')
65 tlds = [tld.strip().lower() for tld64 if tldfile:
66 in resource_stream(__name__, '../data/tlds-alpha-by-domain.txt')65 f = file(tldfile, 'r')
67 .readlines()66 tlds = [tld.strip().lower() for tld in f.readlines()
68 if not tld.startswith('#')67 if not tld.startswith('#')]
69 ]68 f.close()
70
71 else:69 else:
72 log.warning(u"Couldn't open TLD list, falling back to minimal default")70 log.warning(u"Couldn't open TLD list, falling back to minimal default")
73 tlds = 'com.org.net.za'.split('.')71 tlds = 'com.org.net.za'.split('.')
7472
=== modified file 'ibid/source/http.py'
--- ibid/source/http.py 2010-01-18 22:53:52 +0000
+++ ibid/source/http.py 2010-02-06 10:03:13 +0000
@@ -6,15 +6,16 @@
6from twisted.web import server, resource, static, xmlrpc, soap6from twisted.web import server, resource, static, xmlrpc, soap
7from twisted.application import internet7from twisted.application import internet
8from twisted.internet import reactor8from twisted.internet import reactor
9from pkg_resources import resource_filename9from jinja import Environment, FileSystemLoader
10from jinja import Environment, PackageLoader
1110
12import ibid11import ibid
13from ibid.source import IbidSourceFactory12from ibid.source import IbidSourceFactory
14from ibid.event import Event13from ibid.event import Event
15from ibid.config import Option, IntOption14from ibid.config import Option, IntOption
15from ibid.utils import locate_resource
1616
17templates = Environment(loader=PackageLoader('ibid', 'templates'))17templates = Environment(loader=FileSystemLoader(
18 locate_resource('ibid', 'templates')))
1819
19class Index(resource.Resource):20class Index(resource.Resource):
2021
@@ -101,7 +102,7 @@
101 root = Plugin(name)102 root = Plugin(name)
102 root.putChild('', Index(name))103 root.putChild('', Index(name))
103 root.putChild('message', Message(name))104 root.putChild('message', Message(name))
104 root.putChild('static', static.File(resource_filename('ibid', 'static')))105 root.putChild('static', static.File(locate_resource('ibid', 'static')))
105 root.putChild('RPC2', XMLRPC())106 root.putChild('RPC2', XMLRPC())
106 root.putChild('SOAP', SOAP())107 root.putChild('SOAP', SOAP())
107 self.site = server.Site(root)108 self.site = server.Site(root)
108109
=== removed file 'ibid/templates/__init__.py'
=== modified file 'ibid/utils/__init__.py'
--- ibid/utils/__init__.py 2010-02-03 11:48:04 +0000
+++ ibid/utils/__init__.py 2010-02-06 10:03:13 +0000
@@ -17,6 +17,7 @@
17import zlib17import zlib
1818
19from dateutil.tz import tzlocal, tzutc19from dateutil.tz import tzlocal, tzutc
20from pkg_resources import resource_exists, resource_filename
2021
21import ibid22import ibid
22from ibid.compat import defaultdict, json23from ibid.compat import defaultdict, json
@@ -228,4 +229,15 @@
228 return singular229 return singular
229 return plural230 return plural
230231
232def locate_resource(path, filename):
233 "Locate a resource either within the botdir or the source tree"
234 fspath = os.path.join(*(
235 [ibid.options['base']] + path.split('.') + [filename]
236 ))
237 if os.path.exists(fspath):
238 return fspath
239 if not resource_exists(path, filename):
240 return None
241 return resource_filename(path, filename)
242
231# vi: set et sta sw=4 ts=4:243# vi: set et sta sw=4 ts=4:
232244
=== modified file 'scripts/ibid-plugin'
--- scripts/ibid-plugin 2010-01-29 16:35:04 +0000
+++ scripts/ibid-plugin 2010-02-06 10:03:13 +0000
@@ -20,7 +20,6 @@
20sys.path.insert(0, '.')20sys.path.insert(0, '.')
2121
22import ibid22import ibid
23import ibid.plugins
24from ibid.config import FileConfig23from ibid.config import FileConfig
25from ibid.db.models import Identity24from ibid.db.models import Identity
26from ibid.event import Event25from ibid.event import Event
@@ -57,6 +56,7 @@
5756
58#ibid.plugins.auth_responses = auth_responses57#ibid.plugins.auth_responses = auth_responses
59ibid.options = {'base': '.'}58ibid.options = {'base': '.'}
59import ibid.plugins
6060
61logging.basicConfig(level=logging.DEBUG)61logging.basicConfig(level=logging.DEBUG)
62ibid.config = FileConfig("ibid.ini")62ibid.config = FileConfig("ibid.ini")

Subscribers

People subscribed via source and target branches