On Dec 21, 2012, at 01:29 AM, Sandesh Agrawal wrote: >1. 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' >>> >2. 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 _______________________________________________ Mailman-Developers mailing list Mailman-Developers@python.org http://mail.python.org/mailman/listinfo/mailman-developers Mailman FAQ: http://wiki.list.org/x/AgA3 Searchable Archives: http://www.mail-archive.com/mailman-developers%40python.org/ Unsubscribe: http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org Security Policy: http://wiki.list.org/x/QIA9