Re: [Mailman-Developers] New to mailman
On Dec 21, 2012, at 01:29 AM, Sandesh Agrawal wrote:
- I was going through ~/runners/lmtp.py in mailman 3 source code and found a line "from zope.component import getUtility" but there is no folder named zope anywhere, am i missing something ?
After you've done the buildout steps, you'll notice a directory at the root called 'eggs'. These are a Python packaging format, which can be directories or zip (.egg) files though we only use directories. If you look in there, you'll see a zope.component egg directory which buildout grabbed from PyPI. When you run scripts in the bin directory, buildout will have set up all the magic so that imports from the eggs directory Just Work.
Note that once we get to deploying this, we won't use buildout eggs. Most likely, dependencies such as zope.component will come from your OS vendor. Or alternatively, if you use virtualenv, those would also be downloaded from PyPI, although the mechanism to make them available to Python code is somewhat different.
You can always test this out interactively:
$ bin/py Python 2.7.3 (default, Dec 12 2012, 19:00:09) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import zope.component zope.component.__file__ '/home/barry/projects/mailman/3.0/eggs/zope.component-4.0.1-py2.7.egg/zope/component/__init__.pyc'
- Where are the definition of all the functions of classes defined in /mailman/interfaces in mailman 3 source code present ?
These you do have to hunt around for. Many are defined in the various src/mailman/model/*.py classes, but those are only the Storm ORM classes. Others can be defined almost anywhere.
Some of the interfaces define "utilities", essentially singleton instances implementing an interface. If you look at src/mailman/config/configure.zcml, you'll see the zope.component definition file hooking those interfaces up to the classes that implement the utilities.
Others are "adapters", which take one interfaces and wrap them up into other interfaces. E.g. if you have an IMailingList and want to get an IBanManager from it, you "adapt it" in zope.component parlance. Inside configure.zcml, you'll see where the class implementing the adapter (a.k.a. the "factory") is defined.
Some interfaces can have multiple instances, and the classes implementing them can live anywhere. There's no registration service for such things because they usually aren't instantiated by interface name, so they are harder to find. Examples include the IRule instances (which live in src/mailman/rules/*.py) or the IHandlers (src/mailman/handlers/*.py).
It's helpful to have a good support from your text editor or file system to find things, such as a class browser, tags, or for Emacs users bzr-tools-grep.
Cheers, -Barry
while running this :
from mailman.commands.tests.test_control import make_config
i got the following error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "mailman/__init__.py", line 50, in <module> from mailman.core.i18n import initialize File "mailman/core/i18n.py", line 31, in <module> from flufl.i18n import PackageStrategy, registry ImportError: No module named flufl.i18n
flufl.i18n is present in "eggs" directory which is above the mailman directory in hierarchy , so just mentioning "from flufl.i18n" can not detect the required python module.
How can this problem be fixed ?
participants (2)
-
Barry Warsaw
-
Sandesh Agrawal