<-- Back to Andy Balaam Home

MyAddressBook Home | User Guide | Developers | Demo site | Contact

MyAddressBook Developers' Guide

MyAddressBook is written in Python and web.py, using python-ldap for LDAP access. It uses JavaScript and jQuery on the client side.

The project page hosts the code and other information.

Getting the code

MyAddressBook v2's code is stored in git. To check it out:

 git clone https://codeberg.org/andybalaam/myaddressbook.git

Running the development code

To run MyAddressBook in place:

 cd myaddressbook
 ./myaddressbook-local.py

A URL will be printed out - navigate to that URL in your browser and you should see MyAddressBook's user interface.

Changing settings

If you create a file called myaddressbook.cfg in the current directory, it is used for configuration. Otherwise, MyAddressBook will look for /etc/myaddressbook.cfg. If no file exists there either, default settings are used.

See the file myaddressbook.cfg.sample in the top level of the source tree to see the available settings. Remove the '#' at the beginning of a line to make it active. The settings shown in the sample are the defaults that will be used if settings are omitted.

Test-driven development

MyAddressBook is written using test-driven development. All changes should be accompanied by a test.

Where possible, tests are written in Python and placed inside the mabtest/fast directory. Test are functions whose name starts with test_ and test modules need to be imported in fast.py. To run the python tests, type ./mabtest.py in the top of the source tree.

Tests that require a live LDAP server (highly preferable to avoid) go inside mabtest/live_ldap_server. As with the fast tests, test are functions whose name starts with test_ and test modules need to be imported in live_ldap_server.py. To run the live python tests, type ./mabtest.py --live in the top of the source tree.

Tests that cover JavaScript and page layout are written in JavaScript using jQuery's QUnit test framework. All tests are in the file static/test/qunit/mab-tests.js. To run the QUnit tests, navigate to http://0.0.0.0:8080/test (or add test to the URL you are using). These tests are slow, and should be avoided where a Python test can be used instead.

Edit | History | Print | Recent Changes | Search | Admin Page last modified on November 04, 2022, at 07:17 PM