forked from Pylons/pyramid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HISTORY.txt
2499 lines (1861 loc) · 101 KB
/
HISTORY.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1.2 (2011-09-12)
================
Features
--------
- Route pattern replacement marker names can now begin with an underscore.
See https://github.com/Pylons/pyramid/issues/276.
1.2b3 (2011-09-11)
==================
Bug Fixes
---------
- The route prefix was not taken into account when a static view was added in
an "include". See https://github.com/Pylons/pyramid/issues/266 .
1.2b2 (2011-09-08)
==================
Bug Fixes
---------
- The 1.2b1 tarball was a brownbag (particularly for Windows users) because
it contained filenames with stray quotation marks in inappropriate places.
We depend on ``setuptools-git`` to produce release tarballs, and when it
was run to produce the 1.2b1 tarball, it didn't yet cope well with files
present in git repositories with high-order characters in their filenames.
Documentation
-------------
- Minor tweaks to the "Introduction" narrative chapter example app and
wording.
1.2b1 (2011-09-08)
==================
Bug Fixes
---------
- Sometimes falling back from territory translations (``de_DE``) to language
translations (``de``) would not work properly when using a localizer. See
https://github.com/Pylons/pyramid/issues/263
- The static file serving machinery could not serve files that started with a
``.`` (dot) character.
- Static files with high-order (super-ASCII) characters in their names could
not be served by a static view. The static file serving machinery
inappropriately URL-quoted path segments in filenames when asking for files
from the filesystem.
- Within ``pyramid.traversal.traversal_path`` , canonicalize URL segments
from UTF-8 to Unicode before checking whether a segment matches literally
one of ``.``, the empty string, or ``..`` in case there's some sneaky way
someone might tunnel those strings via UTF-8 that don't match the literals
before decoded.
Documentation
-------------
- Added a "What Makes Pyramid Unique" section to the Introduction narrative
chapter.
1.2a6 (2011-09-06)
==================
Bug Fixes
---------
- AuthTktAuthenticationPolicy with a ``reissue_time`` interfered with logout.
See https://github.com/Pylons/pyramid/issues/262.
Internal
--------
- Internalize code previously depended upon as imports from the
``paste.auth`` module (futureproof).
- Replaced use of ``paste.urlparser.StaticURLParser`` with a derivative of
Chris Rossi's "happy" static file serving code (futureproof).
- Fixed test suite; on some systems tests would fail due to indeterminate
test run ordering and a double-push-single-pop of a shared test variable.
Behavior Differences
--------------------
- An ETag header is no longer set when serving a static file. A
Last-Modified header is set instead.
- Static file serving no longer supports the ``wsgi.file_wrapper`` extension.
- Instead of returning a ``403 Forbidden`` error when a static file is served
that cannot be accessed by the Pyramid process' user due to file
permissions, an IOError (or similar) will be raised.
Scaffolds
---------
- All scaffolds now send the ``cache_max_age`` parameter to the
``add_static_view`` method.
1.2a5 (2011-09-04)
==================
Bug Fixes
---------
- The ``route_prefix`` of a configurator was not properly taken into account
when registering routes in certain circumstances. See
https://github.com/Pylons/pyramid/issues/260
Dependencies
------------
- The ``zope.configuration`` package is no longer a dependency.
1.2a4 (2011-09-02)
==================
Features
--------
- Support an ``onerror`` keyword argument to
``pyramid.config.Configurator.scan()``. This onerror keyword argument is
passed to ``venusian.Scanner.scan()`` to influence error behavior when
an exception is raised during scanning.
- The ``request_method`` predicate argument to
``pyramid.config.Configurator.add_view`` and
``pyramid.config.Configurator.add_route`` is now permitted to be a tuple of
HTTP method names. Previously it was restricted to being a string
representing a single HTTP method name.
- Undeprecated ``pyramid.traversal.find_model``,
``pyramid.traversal.model_path``, ``pyramid.traversal.model_path_tuple``,
and ``pyramid.url.model_url``, which were all deprecated in Pyramid 1.0.
There's just not much cost to keeping them around forever as aliases to
their renamed ``resource_*`` prefixed functions.
- Undeprecated ``pyramid.view.bfg_view``, which was deprecated in Pyramid
1.0. This is a low-cost alias to ``pyramid.view.view_config`` which we'll
just keep around forever.
Dependencies
------------
- Pyramid now requires Venusian 1.0a1 or better to support the ``onerror``
keyword argument to ``pyramid.config.Configurator.scan``.
1.2a3 (2011-08-29)
==================
Bug Fixes
---------
- Pyramid did not properly generate static URLs using
``pyramid.url.static_url`` when passed a caller-package relative path due
to a refactoring done in 1.2a1.
- The ``settings`` object emitted a deprecation warning any time
``__getattr__`` was called upon it. However, there are legitimate
situations in which ``__getattr__`` is called on arbitrary objects
(e.g. ``hasattr``). Now, the ``settings`` object only emits the warning
upon successful lookup.
Internal
--------
- Use ``config.with_package`` in view_config decorator rather than
manufacturing a new renderer helper (cleanup).
1.2a2 (2011-08-27)
==================
Bug Fixes
---------
- When a ``renderers=`` argument is not specified to the Configurator
constructor, eagerly register and commit the default renderer set. This
permits the overriding of the default renderers, which was broken in 1.2a1
without a commit directly after Configurator construction.
- Mako rendering exceptions had the wrong value for an error message.
- An include could not set a root factory successfully because the
Configurator constructor unconditionally registered one that would be
treated as if it were "the word of the user".
Features
--------
- A session factory can now be passed in using the dotted name syntax.
1.2a1 (2011-08-24)
==================
Features
--------
- The ``[pshell]`` section in an ini configuration file now treats a
``setup`` key as a dotted name that points to a callable that is passed the
bootstrap environment. It can mutate the environment as necessary for
great justice.
- A new configuration setting named ``pyramid.includes`` is now available.
It is described in the "Environment Variables and ``.ini`` Files Settings"
narrative documentation chapter.
- Added a ``route_prefix`` argument to the
``pyramid.config.Configurator.include`` method. This argument allows you
to compose URL dispatch applications together. See the section entitled
"Using a Route Prefix to Compose Applications" in the "URL Dispatch"
narrative documentation chapter.
- Added a ``pyramid.security.NO_PERMISSION_REQUIRED`` constant for use in
``permission=`` statements to view configuration. This constant has a
value of the string ``__no_permission_required__``. This string value was
previously referred to in documentation; now the documentation uses the
constant.
- Added a decorator-based way to configure a response adapter:
``pyramid.response.response_adapter``. This decorator has the same use as
``pyramid.config.Configurator.add_response_adapter`` but it's declarative.
- The ``pyramid.events.BeforeRender`` event now has an attribute named
``rendering_val``. This can be used to introspect the value returned by a
view in a BeforeRender subscriber.
- New configurator directive: ``pyramid.config.Configurator.add_tween``.
This directive adds a "tween". A "tween" is used to wrap the Pyramid
router's primary request handling function. This is a feature may be used
by Pyramid framework extensions, to provide, for example, view timing
support and as a convenient place to hang bookkeeping code.
Tweens are further described in the narrative docs section in the Hooks
chapter, named "Registering Tweens".
- New paster command ``paster ptweens``, which prints the current "tween"
configuration for an application. See the section entitled "Displaying
Tweens" in the Command-Line Pyramid chapter of the narrative documentation
for more info.
- The Pyramid debug logger now uses the standard logging configuration
(usually set up by Paste as part of startup). This means that output from
e.g. ``debug_notfound``, ``debug_authorization``, etc. will go to the
normal logging channels. The logger name of the debug logger will be the
package name of the *caller* of the Configurator's constructor.
- A new attribute is available on request objects: ``exc_info``. Its value
will be ``None`` until an exception is caught by the Pyramid router, after
which it will be the result of ``sys.exc_info()``.
- ``pyramid.testing.DummyRequest`` now implements the
``add_finished_callback`` and ``add_response_callback`` methods.
- New methods of the ``pyramid.config.Configurator`` class:
``set_authentication_policy`` and ``set_authorization_policy``. These are
meant to be consumed mostly by add-on authors.
- New Configurator method: ``set_root_factory``.
- Pyramid no longer eagerly commits some default configuration statements at
Configurator construction time, which permits values passed in as
constructor arguments (e.g. ``authentication_policy`` and
``authorization_policy``) to override the same settings obtained via an
"include".
- Better Mako rendering exceptions via
``pyramid.mako_templating.MakoRenderingException``
- New request methods: ``current_route_url``, ``current_route_path``, and
``static_path``.
- New functions in ``pyramid.url``: ``current_route_path`` and
``static_path``.
- The ``pyramid.request.Request.static_url`` API (and its brethren
``pyramid.request.Request.static_path``, ``pyramid.url.static_url``, and
``pyramid.url.static_path``) now accept an asbolute filename as a "path"
argument. This will generate a URL to an asset as long as the filename is
in a directory which was previously registered as a static view.
Previously, trying to generate a URL to an asset using an absolute file
path would raise a ValueError.
- The ``RemoteUserAuthenticationPolicy ``, ``AuthTktAuthenticationPolicy``,
and ``SessionAuthenticationPolicy`` constructors now accept an additional
keyword argument named ``debug``. By default, this keyword argument is
``False``. When it is ``True``, debug information will be sent to the
Pyramid debug logger (usually on stderr) when the ``authenticated_userid``
or ``effective_principals`` method is called on any of these policies. The
output produced can be useful when trying to diagnose
authentication-related problems.
- New view predicate: ``match_param``. Example: a view added via
``config.add_view(aview, match_param='action=edit')`` will be called only
when the ``request.matchdict`` has a value inside it named ``action`` with
a value of ``edit``.
Internal
--------
- The Pyramid "exception view" machinery is now implemented as a "tween"
(``pyramid.tweens.excview_tween_factory``).
- WSGIHTTPException (HTTPFound, HTTPNotFound, etc) now has a new API named
"prepare" which renders the body and content type when it is provided with
a WSGI environ. Required for debug toolbar.
- Once ``__call__`` or ``prepare`` is called on a WSGIHTTPException, the body
will be set, and subsequent calls to ``__call__`` will always return the
same body. Delete the body attribute to rerender the exception body.
- Previously the ``pyramid.events.BeforeRender`` event *wrapped* a dictionary
(it addressed it as its ``_system`` attribute). Now it *is* a dictionary
(it inherits from ``dict``), and it's the value that is passed to templates
as a top-level dictionary.
- The ``route_url``, ``route_path``, ``resource_url``, ``static_url``, and
``current_route_url`` functions in the ``pyramid.url`` package now delegate
to a method on the request they've been passed, instead of the other way
around. The pyramid.request.Request object now inherits from a mixin named
pyramid.url.URLMethodsMixin to make this possible, and all url/path
generation logic is embedded in this mixin.
- Refactor ``pyramid.config`` into a package.
- Removed the ``_set_security_policies`` method of the Configurator.
- Moved the ``StaticURLInfo`` class from ``pyramid.static`` to
``pyramid.config.views``.
- Move the ``Settings`` class from ``pyramid.settings`` to
``pyramid.config.settings``.
- Move the ``OverrideProvider``, ``PackageOverrides``, ``DirectoryOverride``,
and ``FileOverride`` classes from ``pyramid.asset`` to
``pyramid.config.assets``.
Deprecations
------------
- All Pyramid-related deployment settings (e.g. ``debug_all``,
``debug_notfound``) are now meant to be prefixed with the prefix
``pyramid.``. For example: ``debug_all`` -> ``pyramid.debug_all``. The
old non-prefixed settings will continue to work indefinitely but supplying
them may eventually print a deprecation warning. All scaffolds and
tutorials have been changed to use prefixed settings.
- The ``settings`` dictionary now raises a deprecation warning when you
attempt to access its values via ``__getattr__`` instead of
via ``__getitem__``.
Backwards Incompatibilities
---------------------------
- If a string is passed as the ``debug_logger`` parameter to a Configurator,
that string is considered to be the name of a global Python logger rather
than a dotted name to an instance of a logger.
- The ``pyramid.config.Configurator.include`` method now accepts only a
single ``callable`` argument (a sequence of callables used to be
permitted). If you are passing more than one ``callable`` to
``pyramid.config.Configurator.include``, it will break. You now must now
instead make a separate call to the method for each callable. This change
was introduced to support the ``route_prefix`` feature of include.
- It may be necessary to more strictly order configuration route and view
statements when using an "autocommitting" Configurator. In the past, it
was possible to add a view which named a route name before adding a route
with that name when you used an autocommitting configurator. For example::
config = Configurator(autocommit=True)
config.add_view('my.pkg.someview', route_name='foo')
config.add_route('foo', '/foo')
The above will raise an exception when the view attempts to add itself.
Now you must add the route before adding the view::
config = Configurator(autocommit=True)
config.add_route('foo', '/foo')
config.add_view('my.pkg.someview', route_name='foo')
This won't effect "normal" users, only people who have legacy BFG codebases
that used an autommitting configurator and possibly tests that use the
configurator API (the configurator returned by ``pyramid.testing.setUp`` is
an autocommitting configurator). The right way to get around this is to
use a non-autocommitting configurator (the default), which does not have
these directive ordering requirements.
- The ``pyramid.config.Configurator.add_route`` directive no longer returns a
route object. This change was required to make route vs. view
configuration processing work properly.
Documentation
-------------
- Narrative and API documentation which used the ``route_url``,
``route_path``, ``resource_url``, ``static_url``, and ``current_route_url``
functions in the ``pyramid.url`` package have now been changed to use
eponymous methods of the request instead.
- Added a section entitled "Using a Route Prefix to Compose Applications" to
the "URL Dispatch" narrative documentation chapter.
- Added a new module to the API docs: ``pyramid.tweens``.
- Added a "Registering Tweens" section to the "Hooks" narrative chapter.
- Added a "Displaying Tweens" section to the "Command-Line Pyramid" narrative
chapter.
- Added documentation for the ``pyramid.tweens`` and ``pyramid.includes``
configuration settings to the "Environment Variables and ``.ini`` Files
Settings" chapter.
- Added a Logging chapter to the narrative docs (based on the Pylons logging
docs, thanks Phil).
- Added a Paste chapter to the narrative docs (moved content from the Project
chapter).
- Added the ``pyramid.interfaces.IDict`` interface representing the methods
of a dictionary, for documentation purposes only (IMultiDict and
IBeforeRender inherit from it).
- All tutorials now use - The ``route_url``, ``route_path``,
``resource_url``, ``static_url``, and ``current_route_url`` methods of the
request rather than the function variants imported from ``pyramid.url``.
- The ZODB wiki tutorial now uses the ``pyramid_zodbconn`` package rather
than the ``repoze.zodbconn`` package to provide ZODB integration.
Dependency Changes
------------------
- Pyramid now relies on PasteScript >= 1.7.4. This version contains a
feature important for allowing flexible logging configuration.
Scaffolds
----------
- All scaffolds now use the ``pyramid_tm`` package rather than the
``repoze.tm2`` middleware to manage transaction management.
- The ZODB scaffold now uses the ``pyramid_zodbconn`` package rather than the
``repoze.zodbconn`` package to provide ZODB integration.
- All scaffolds now use the ``pyramid_debugtoolbar`` package rather than the
``WebError`` package to provide interactive debugging features.
- Projects created via a scaffold no longer depend on the ``WebError``
package at all; configuration in the ``production.ini`` file which used to
require its ``error_catcher`` middleware has been removed. Configuring
error catching / email sending is now the domain of the ``pyramid_exclog``
package (see http://docs.pylonsproject.org/projects/pyramid_exclog/dev/).
Bug Fixes
---------
- Fixed an issue with the default renderer not working at certain times. See
https://github.com/Pylons/pyramid/issues/249
1.1 (2011-07-22)
================
Features
--------
- Added the ``pyramid.renderers.null_renderer`` object as an API. The null
renderer is an object that can be used in advanced integration cases as
input to the view configuration ``renderer=`` argument. When the null
renderer is used as a view renderer argument, Pyramid avoids converting the
view callable result into a Response object. This is useful if you want to
reuse the view configuration and lookup machinery outside the context of
its use by the Pyramid router. This feature was added for consumption by
the ``pyramid_rpc`` package, which uses view configuration and lookup
outside the context of a router in exactly this way. ``pyramid_rpc`` has
been broken under 1.1 since 1.1b1; adding it allows us to make it work
again.
- Change all scaffolding templates that point to docs.pylonsproject.org to
use ``/projects/pyramid/current`` rather than ``/projects/pyramid/dev``.
Internals
---------
- Remove ``compat`` code that served only the purpose of providing backwards
compatibility with Python 2.4.
- Add a deprecation warning for non-API function
``pyramid.renderers.renderer_from_name`` which has seen use in the wild.
- Add a ``clone`` method to ``pyramid.renderers.RendererHelper`` for use by
the ``pyramid.view.view_config`` decorator.
Documentation
-------------
- Fixed two typos in wiki2 (SQLA + URL Dispatch) tutorial.
- Reordered chapters in narrative section for better new user friendliness.
- Added more indexing markers to sections in documentation.
1.1b4 (2011-07-18)
==================
Documentation
-------------
- Added a section entitled "Writing a Script" to the "Command-Line Pyramid"
chapter.
Backwards Incompatibilities
---------------------------
- We added the ``pyramid.scripting.make_request`` API too hastily in 1.1b3.
It has been removed. Sorry for any inconvenience. Use the
``pyramid.request.Request.blank`` API instead.
Features
--------
- The ``paster pshell``, ``paster pviews``, and ``paster proutes`` commands
each now under the hood uses ``pyramid.paster.bootstrap``, which makes it
possible to supply an ``.ini`` file without naming the "right" section in
the file that points at the actual Pyramid application. Instead, you can
generally just run ``paster {pshell|proutes|pviews} development.ini`` and
it will do mostly the right thing.
Bug Fixes
---------
- Omit custom environ variables when rendering a custom exception template in
``pyramid.httpexceptions.WSGIHTTPException._set_default_attrs``;
stringifying thse may trigger code that should not be executed; see
https://github.com/Pylons/pyramid/issues/239
1.1b3 (2011-07-15)
==================
Features
--------
- Fix corner case to ease semifunctional testing of views: create a new
rendererinfo to clear out old registry on a rescan. See
https://github.com/Pylons/pyramid/pull/234.
- New API class: ``pyramid.static.static_view``. This supersedes the
deprecated ``pyramid.view.static`` class. ``pyramid.static.static_view``
by default serves up documents as the result of the request's
``path_info``, attribute rather than it's ``subpath`` attribute (the
inverse was true of ``pyramid.view.static``, and still is).
``pyramid.static.static_view`` exposes a ``use_subpath`` flag for use when
you want the static view to behave like the older deprecated version.
- A new API function ``pyramid.paster.bootstrap`` has been added to make
writing scripts that bootstrap a Pyramid environment easier, e.g.::
from pyramid.paster import bootstrap
info = bootstrap('/path/to/my/development.ini')
request = info['request']
print request.route_url('myroute')
- A new API function ``pyramid.scripting.prepare`` has been added. It is a
lower-level analogue of ``pyramid.paster.boostrap`` that accepts a request
and a registry instead of a config file argument, and is used for the same
purpose::
from pyramid.scripting import prepare
info = prepare(registry=myregistry)
request = info['request']
print request.route_url('myroute')
- A new API function ``pyramid.scripting.make_request`` has been added. The
resulting request will have a ``registry`` attribute. It is meant to be
used in conjunction with ``pyramid.scripting.prepare`` and/or
``pyramid.paster.bootstrap`` (both of which accept a request as an
argument)::
from pyramid.scripting import make_request
request = make_request('/')
- New API attribute ``pyramid.config.global_registries`` is an iterable
object that contains references to every Pyramid registry loaded into the
current process via ``pyramid.config.Configurator.make_app``. It also has
a ``last`` attribute containing the last registry loaded. This is used by
the scripting machinery, and is available for introspection.
Deprecations
------------
- The ``pyramid.view.static`` class has been deprecated in favor of the newer
``pyramid.static.static_view`` class. A deprecation warning is raised when
it is used. You should replace it with a reference to
``pyramid.static.static_view`` with the ``use_subpath=True`` argument.
Bug Fixes
---------
- Without a mo-file loaded for the combination of domain/locale,
``pyramid.i18n.Localizer.pluralize`` run using that domain/locale
combination raised an inscrutable "translations object has no attr
'plural'" error. Now, instead it "works" (it uses a germanic pluralization
by default). It's nonsensical to try to pluralize something without
translations for that locale/domain available, but this behavior matches
the behavior of ``pyramid.i18n.Localizer.translate`` so it's at least
consistent; see https://github.com/Pylons/pyramid/issues/235.
1.1b2 (2011-07-13)
==================
Features
--------
- New environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and new
configuration file value ``prevent_http_cache``. These are synomymous and
allow you to prevent HTTP cache headers from being set by Pyramid's
``http_cache`` machinery globally in a process. see the "Influencing HTTP
Caching" section of the "View Configuration" narrative chapter and the
detailed documentation for this setting in the "Environment Variables and
Configuration Settings" narrative chapter.
Behavior Changes
----------------
- Previously, If a ``BeforeRender`` event subscriber added a value via the
``__setitem__`` or ``update`` methods of the event object with a key that
already existed in the renderer globals dictionary, a ``KeyError`` was
raised. With the deprecation of the "add_renderer_globals" feature of the
configurator, there was no way to override an existing value in the
renderer globals dictionary that already existed. Now, the event object
will overwrite an older value that is already in the globals dictionary
when its ``__setitem__`` or ``update`` is called (as well as the new
``setdefault`` method), just like a plain old dictionary. As a result, for
maximum interoperability with other third-party subscribers, if you write
an event subscriber meant to be used as a BeforeRender subscriber, your
subscriber code will now need to (using ``.get`` or ``__contains__`` of the
event object) ensure no value already exists in the renderer globals
dictionary before setting an overriding value.
Bug Fixes
---------
- The ``Configurator.add_route`` method allowed two routes with the same
route to be added without an intermediate ``config.commit()``. If you now
receive a ``ConfigurationError`` at startup time that appears to be
``add_route`` related, you'll need to either a) ensure that all of your
route names are unique or b) call ``config.commit()`` before adding a
second route with the name of a previously added name or c) use a
Configurator that works in ``autocommit`` mode.
- The ``pyramid_routesalchemy`` and ``pyramid_alchemy`` scaffolds
inappropriately used ``DBSession.rollback()`` instead of
``transaction.abort()`` in one place.
- We now clear ``request.response`` before we invoke an exception view; an
exception view will be working with a request.response that has not been
touched by any code prior to the exception.
- Views associated with routes with spaces in the route name may not have
been looked up correctly when using Pyramid with ``zope.interface`` 3.6.4
and better. See https://github.com/Pylons/pyramid/issues/232.
Documentation
-------------
- Wiki2 (SQLAlchemy + URL Dispatch) tutorial ``models.initialize_sql`` didn't
match the ``pyramid_routesalchemy`` scaffold function of the same name; it
didn't get synchronized when it was changed in the scaffold.
- New documentation section in View Configuration narrative chapter:
"Influencing HTTP Caching".
1.1b1 (2011-07-10)
==================
Features
--------
- It is now possible to invoke ``paster pshell`` even if the paste ini file
section name pointed to in its argument is not actually a Pyramid WSGI
application. The shell will work in a degraded mode, and will warn the
user. See "The Interactive Shell" in the "Creating a Pyramid Project"
narrative documentation section.
- ``paster pshell`` now offers more built-in global variables by default
(including ``app`` and ``settings``). See "The Interactive Shell" in the
"Creating a Pyramid Project" narrative documentation section.
- It is now possible to add a ``[pshell]`` section to your application's .ini
configuration file, which influences the global names available to a pshell
session. See "Extending the Shell" in the "Creating a Pyramid Project"
narrative documentation chapter.
- The ``config.scan`` method has grown a ``**kw`` argument. ``kw`` argument
represents a set of keyword arguments to pass to the Venusian ``Scanner``
object created by Pyramid. (See the Venusian documentation for more
information about ``Scanner``).
- New request property: ``json_body``. This property will return the
JSON-decoded variant of the request body. If the request body is not
well-formed JSON, this property will raise an exception.
- A new value ``http_cache`` can be used as a view configuration
parameter.
When you supply an ``http_cache`` value to a view configuration, the
``Expires`` and ``Cache-Control`` headers of a response generated by the
associated view callable are modified. The value for ``http_cache`` may be
one of the following:
- A nonzero integer. If it's a nonzero integer, it's treated as a number
of seconds. This number of seconds will be used to compute the
``Expires`` header and the ``Cache-Control: max-age`` parameter of
responses to requests which call this view. For example:
``http_cache=3600`` instructs the requesting browser to 'cache this
response for an hour, please'.
- A ``datetime.timedelta`` instance. If it's a ``datetime.timedelta``
instance, it will be converted into a number of seconds, and that number
of seconds will be used to compute the ``Expires`` header and the
``Cache-Control: max-age`` parameter of responses to requests which call
this view. For example: ``http_cache=datetime.timedelta(days=1)``
instructs the requesting browser to 'cache this response for a day,
please'.
- Zero (``0``). If the value is zero, the ``Cache-Control`` and
``Expires`` headers present in all responses from this view will be
composed such that client browser cache (and any intermediate caches) are
instructed to never cache the response.
- A two-tuple. If it's a two tuple (e.g. ``http_cache=(1,
{'public':True})``), the first value in the tuple may be a nonzero
integer or a ``datetime.timedelta`` instance; in either case this value
will be used as the number of seconds to cache the response. The second
value in the tuple must be a dictionary. The values present in the
dictionary will be used as input to the ``Cache-Control`` response
header. For example: ``http_cache=(3600, {'public':True})`` means 'cache
for an hour, and add ``public`` to the Cache-Control header of the
response'. All keys and values supported by the
``webob.cachecontrol.CacheControl`` interface may be added to the
dictionary. Supplying ``{'public':True}`` is equivalent to calling
``response.cache_control.public = True``.
Providing a non-tuple value as ``http_cache`` is equivalent to calling
``response.cache_expires(value)`` within your view's body.
Providing a two-tuple value as ``http_cache`` is equivalent to calling
``response.cache_expires(value[0], **value[1])`` within your view's body.
If you wish to avoid influencing, the ``Expires`` header, and instead wish
to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache``
with the first element of ``None``, e.g.: ``(None, {'public':True})``.
Bug Fixes
---------
- Framework wrappers of the original view (such as http_cached and so on)
relied on being able to trust that the response they were receiving was an
IResponse. It wasn't always, because the response was resolved by the
router instead of early in the view wrapping process. This has been fixed.
Documentation
-------------
- Added a section in the "Webob" chapter named "Dealing With A JSON-Encoded
Request Body" (usage of ``request.json_body``).
Behavior Changes
----------------
- The ``paster pshell``, ``paster proutes``, and ``paster pviews`` commands
now take a single argument in the form ``/path/to/config.ini#sectionname``
rather than the previous 2-argument spelling ``/path/to/config.ini
sectionname``. ``#sectionname`` may be omitted, in which case ``#main`` is
assumed.
1.1a4 (2011-07-01)
==================
Bug Fixes
---------
- ``pyramid.testing.DummyRequest`` now raises deprecation warnings when
attributes deprecated for ``pyramid.request.Request`` are accessed (like
``response_content_type``). This is for the benefit of folks running unit
tests which use DummyRequest instead of a "real" request, so they know
things are deprecated without necessarily needing a functional test suite.
- The ``pyramid.events.subscriber`` directive behaved contrary to the
documentation when passed more than one interface object to its
constructor. For example, when the following listener was registered::
@subscriber(IFoo, IBar)
def expects_ifoo_events_and_ibar_events(event):
print event
The Events chapter docs claimed that the listener would be registered and
listening for both ``IFoo`` and ``IBar`` events. Instead, it registered an
"object event" subscriber which would only be called if an IObjectEvent was
emitted where the object interface was ``IFoo`` and the event interface was
``IBar``.
The behavior now matches the documentation. If you were relying on the
buggy behavior of the 1.0 ``subscriber`` directive in order to register an
object event subscriber, you must now pass a sequence to indicate you'd
like to register a subscriber for an object event. e.g.::
@subscriber([IFoo, IBar])
def expects_object_event(object, event):
print object, event
Features
--------
- Add JSONP renderer (see "JSONP renderer" in the Renderers chapter of the
documentation).
Deprecations
------------
- Deprecated the ``set_renderer_globals_factory`` method of the Configurator
and the ``renderer_globals`` Configurator constructor parameter.
Documentation
-------------
- The Wiki and Wiki2 tutorial "Tests" chapters each had two bugs: neither did
told the user to depend on WebTest, and 2 tests failed in each as the
result of changes to Pyramid itself. These issues have been fixed.
- Move 1.0.X CHANGES.txt entries to HISTORY.txt.
1.1a3 (2011-06-26)
==================
Features
--------
- Added ``mako.preprocessor`` config file parameter; allows for a Mako
preprocessor to be specified as a Python callable or Python dotted name.
See https://github.com/Pylons/pyramid/pull/183 for rationale.
Bug fixes
---------
- Pyramid would raise an AttributeError in the Configurator when attempting
to set a ``__text__`` attribute on a custom predicate that was actually a
classmethod. See https://github.com/Pylons/pyramid/pull/217 .
- Accessing or setting deprecated response_* attrs on request
(e.g. ``response_content_type``) now issues a deprecation warning at access
time rather than at rendering time.
1.1a2 (2011-06-22)
==================
Bug Fixes
---------
- 1.1a1 broke Akhet by not providing a backwards compatibility import shim
for ``pyramid.paster.PyramidTemplate``. Now one has been added, although a
deprecation warning is emitted when Akhet imports it.
- If multiple specs were provided in a single call to
``config.add_translation_dirs``, the directories were inserted into the
beginning of the directory list in the wrong order: they were inserted in
the reverse of the order they were provided in the ``*specs`` list (items
later in the list were added before ones earlier in the list). This is now
fixed.
Backwards Incompatibilities
---------------------------
- The pyramid Router attempted to set a value into the key
``environ['repoze.bfg.message']`` when it caught a view-related exception
for backwards compatibility with applications written for ``repoze.bfg``
during error handling. It did this by using code that looked like so::
# "why" is an exception object
try:
msg = why[0]
except:
msg = ''
environ['repoze.bfg.message'] = msg
Use of the value ``environ['repoze.bfg.message']`` was docs-deprecated in
Pyramid 1.0. Our standing policy is to not remove features after a
deprecation for two full major releases, so this code was originally slated
to be removed in Pyramid 1.2. However, computing the
``repoze.bfg.message`` value was the source of at least one bug found in
the wild (https://github.com/Pylons/pyramid/issues/199), and there isn't a
foolproof way to both preserve backwards compatibility and to fix the bug.
Therefore, the code which sets the value has been removed in this release.
Code in exception views which relies on this value's presence in the
environment should now use the ``exception`` attribute of the request
(e.g. ``request.exception[0]``) to retrieve the message instead of relying
on ``request.environ['repoze.bfg.message']``.
1.1a1 (2011-06-20)
==================
Documentation
-------------
- The term "template" used to refer to both "paster templates" and "rendered
templates" (templates created by a rendering engine. i.e. Mako, Chameleon,
Jinja, etc.). "Paster templates" will now be refered to as "scaffolds",
whereas the name for "rendered templates" will remain as "templates."
- The ``wiki`` (ZODB+Traversal) tutorial was updated slightly.
- The ``wiki2`` (SQLA+URL Dispatch) tutorial was updated slightly.
- Make ``pyramid.interfaces.IAuthenticationPolicy`` and
``pyramid.interfaces.IAuthorizationPolicy`` public interfaces, and refer to
them within the ``pyramid.authentication`` and ``pyramid.authorization``
API docs.
- Render the function definitions for each exposed interface in
``pyramid.interfaces``.
- Add missing docs reference to
``pyramid.config.Configurator.set_view_mapper`` and refer to it within
Hooks chapter section named "Using a View Mapper".
- Added section to the "Environment Variables and ``.ini`` File Settings"
chapter in the narrative documentation section entitled "Adding a Custom
Setting".
- Added documentation for a "multidict" (e.g. the API of ``request.POST``) as
interface API documentation.
- Added a section to the "URL Dispatch" narrative chapter regarding the new
"static" route feature.
- Added "What's New in Pyramid 1.1" to HTML rendering of documentation.
- Added API docs for ``pyramid.authentication.SessionAuthenticationPolicy``.
- Added API docs for ``pyramid.httpexceptions.exception_response``.
- Added "HTTP Exceptions" section to Views narrative chapter including a
description of ``pyramid.httpexceptions.exception_response``.
Features
--------
- Add support for language fallbacks: when trying to translate for a
specific territory (such as ``en_GB``) fall back to translations
for the language (ie ``en``). This brings the translation behaviour in line
with GNU gettext and fixes partially translated texts when using C
extensions.
- New authentication policy:
``pyramid.authentication.SessionAuthenticationPolicy``, which uses a session
to store credentials.
- Accessing the ``response`` attribute of a ``pyramid.request.Request``
object (e.g. ``request.response`` within a view) now produces a new
``pyramid.response.Response`` object. This feature is meant to be used
mainly when a view configured with a renderer needs to set response
attributes: all renderers will use the Response object implied by
``request.response`` as the response object returned to the router.
``request.response`` can also be used by code in a view that does not use a
renderer, however the response object that is produced by
``request.response`` must be returned when a renderer is not in play (it is
not a "global" response).
- Integers and longs passed as ``elements`` to ``pyramid.url.resource_url``
or ``pyramid.request.Request.resource_url`` e.g. ``resource_url(context,
request, 1, 2)`` (``1`` and ``2`` are the ``elements``) will now be
converted implicitly to strings in the result. Previously passing integers
or longs as elements would cause a TypeError.
- ``pyramid_alchemy`` paster template now uses ``query.get`` rather than
``query.filter_by`` to take better advantage of identity map caching.
- ``pyramid_alchemy`` paster template now has unit tests.
- Added ``pyramid.i18n.make_localizer`` API (broken out from
``get_localizer`` guts).
- An exception raised by a NewRequest event subscriber can now be caught by
an exception view.
- It is now possible to get information about why Pyramid raised a Forbidden
exception from within an exception view. The ``ACLDenied`` object returned
by the ``permits`` method of each stock authorization policy
(``pyramid.interfaces.IAuthorizationPolicy.permits``) is now attached to
the Forbidden exception as its ``result`` attribute. Therefore, if you've
created a Forbidden exception view, you can see the ACE, ACL, permission,