upgrading.rst 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. Upgrading
  2. =========
  3. If you're looking to upgrade from an older version of django-browserid, you're
  4. in the right place. This document describes the major changes required to get
  5. your site up to the latest and greatest!
  6. 1.0.0 to 2.0.0
  7. --------------
  8. 2.0.0 introduces a small, but backwards-incompatible change that shouldn't
  9. affect most users. You are only affected if you:
  10. 1. Use the ``browserid_login`` or ``browserid_logout`` template helpers to
  11. generate your login/logout buttons, and
  12. 2. Use custom JavaScript that relies on the ``data-next`` attribute on the
  13. buttons generate by these helpers.
  14. If both of the above apply to you, then you may have to update your custom
  15. JavaScript, as the helpers now default to a blank ``data-next`` value instead
  16. of defaulting to the ``LOGIN_REDIRECT_URL``/``LOGOUT_REDIRECT_URL`` settings.
  17. The default JavaScript does not rely on this, and it's not expected that any
  18. project relies on this either. Most projects should be able to upgrade to the
  19. new version with no changes.
  20. 0.10.1 to 1.0.0
  21. ---------------
  22. No changes are necessary to switch from 0.10.1 to 1.0.0. ``fancy_tag`` was
  23. removed as a dependency in 1.0.0, in case you explicitly include it for your
  24. application.
  25. 0.9 to 0.10.1
  26. -------------
  27. - The minimum supported version of requests is now 1.0.0, and six has been
  28. removed from the requirements.
  29. - Replace the ``SITE_URL`` setting with ``BROWSERID_AUDIENCES``, which is
  30. essentially the same setting, but must be a list of strings (wrapping your
  31. old ``SITE_URL`` value with square brackets to make it a list is fine):
  32. .. code-block:: python
  33. BROWSERID_AUDIENCES = ['https://www.example.com']
  34. - On local development installs, you can remove ``SITE_URL`` entirely, as
  35. ``BROWSERID_AUDIENCES`` isn't required when ``DEBUG`` is True.
  36. - In your root urlconf, remove any regex in front of the include for
  37. django-browserid urls. Because the new JavaScript relies on views being
  38. available at certain URLs, you must not change the path that the
  39. django-browserid views are served:
  40. .. code-block:: python
  41. urlpatterns = patterns('',
  42. # ...
  43. (r'', include('django_browserid.urls')),
  44. # ...
  45. )
  46. - Remove ``django_browserid.context_processors.browserid`` from your
  47. ``TEMPLATE_CONTEXT_PROCESSORS`` setting, as the context processor no longer
  48. exists.
  49. - ``browserid.js`` has been split into ``api.js``, which contains just the
  50. JavaScript API, and ``browserid.js``, which contains the sample code for
  51. hooking up login buttons. If you aren't using the ``browserid_js`` helper to
  52. include the JavaScript on the page, you probably need to update your project
  53. to either include both or just ``api.js``.
  54. - The included JavaScript requires jQuery 1.8 or higher instead of jQuery 1.7.
  55. 0.8 to 0.9
  56. ----------
  57. - Six v1.3 or higher is now required.
  58. 0.7.1 to 0.8
  59. ------------
  60. - fancy_tag 0.2.0 has been added to the required libraries.
  61. - Rename the ``browserid_form`` context processor to ``browserid`` in the
  62. ``TEMPLATE_CONTEXT_PROCESSORS`` setting:
  63. .. code-block:: python
  64. TEMPLATE_CONTEXT_PROCESSORS = (
  65. # ...
  66. 'django_browserid.context_processors.browserid',
  67. # ...
  68. )
  69. - Replace custom login button code with the new template helpers,
  70. ``browserid_info``, ``browserid_login``, and ``browserid_logout``.
  71. - ``browserid_info`` should be added just below ``<body>`` on any page that
  72. includes a login button.
  73. - ``browserid_login`` and ``browserid_logout`` output login and logout links
  74. respectively.
  75. - It's now recommended to include the JavaScript for the login buttons using
  76. the ``browserid_js`` helper, which outputs the appropriate ``<script>`` tags.
  77. - The included JavaScript requires jQuery 1.7 or higher instead of jQuery 1.6.