Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pyramid.pdf
Скачиваний:
10
Добавлен:
24.03.2015
Размер:
3.82 Mб
Скачать

1. PYRAMID INTRODUCTION

6 view = getattr(module, ’xhr_%s_view’ % method, None)

7if view is not None:

8config.add_view(view, route_name=’xhr_route’, xhr=True,

9

permission=’view’, request_method=method)

10

11config = Configurator()

12config.add_directive(’add_protected_xhr_views’, add_protected_xhr_views)

Once that’s done, you can call the directive you’ve just added as a method of the Configurator object:

1

2

config.add_route(’xhr_route’, ’/xhr/{id}’) config.add_protected_xhr_views(’my.package’)

Your previously repetitive configuration lines have now morphed into one line.

You can share your configuration code with others this way too by packaging it up and calling add_directive() from within a function called when another user uses the include() method against your code.

See also Adding Methods to the Configurator via add_directive.

1.1.29 Testing

Every release of Pyramid has 100% statement coverage via unit and integration tests, as measured by the coverage tool available on PyPI. It also has greater than 95% decision/condition coverage as measured by the instrumental tool available on PyPI. It is automatically tested by the Jenkins tool on Python 2.6, Python 2.7, Python 3.2 and PyPy after each commit to its GitHub repository. Official Pyramid addons are held to a similar testing standard. We still find bugs in Pyramid and its official add-ons, but we’ve noticed we find a lot more of them while working on other projects that don’t have a good testing regime.

Example: http://jenkins.pylonsproject.org/

1.1.30 Support

It’s our goal that no Pyramid question go unanswered. Whether you ask a question on IRC, on the Pylonsdiscuss maillist, or on StackOverflow, you’re likely to get a reasonably prompt response. We don’t tolerate “support trolls” or other people who seem to get their rocks off by berating fellow users in our various offical support channels. We try to keep it well-lit and new-user-friendly.

Example: Visit irc://freenode.net#pyramid (the #pyramid channel on irc.freenode.net in an IRC client) or the pylons-discuss maillist at http://groups.google.com/group/pylons-discuss/ .

18

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]