{"id":16421145,"url":"https://github.com/kezabelle/django-contextaware-processors","last_synced_at":"2026-04-28T01:33:24.046Z","repository":{"id":57419525,"uuid":"84192587","full_name":"kezabelle/django-contextaware-processors","owner":"kezabelle","description":"Before a TemplateResponse is rendered, modify the context data in-place with context-processor like functionality","archived":false,"fork":false,"pushed_at":"2017-03-12T16:16:16.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-22T13:09:58.787Z","etag":null,"topics":["django","django-middleware"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kezabelle.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-07T11:41:29.000Z","updated_at":"2017-03-12T16:18:27.000Z","dependencies_parsed_at":"2022-09-08T06:11:46.394Z","dependency_job_id":null,"html_url":"https://github.com/kezabelle/django-contextaware-processors","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kezabelle/django-contextaware-processors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezabelle%2Fdjango-contextaware-processors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezabelle%2Fdjango-contextaware-processors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezabelle%2Fdjango-contextaware-processors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezabelle%2Fdjango-contextaware-processors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kezabelle","download_url":"https://codeload.github.com/kezabelle/django-contextaware-processors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezabelle%2Fdjango-contextaware-processors/sbom","scorecard":{"id":558104,"data":{"date":"2025-08-11","repo":{"name":"github.com/kezabelle/django-contextaware-processors","commit":"7f5bd32b73032fa5b9208f62c2b4438c13a2d78b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/12 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T12:53:02.726Z","repository_id":57419525,"created_at":"2025-08-20T12:53:02.726Z","updated_at":"2025-08-20T12:53:02.726Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32362781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-middleware"],"created_at":"2024-10-11T07:30:36.648Z","updated_at":"2026-04-28T01:33:24.027Z","avatar_url":"https://github.com/kezabelle.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-contextaware-processors\n==============================\n\n:author: Keryn Knight\n:version: 0.1.1\n\n.. |travis_stable| image:: https://travis-ci.org/kezabelle/django-contextaware-processors.svg?branch=0.1.1\n  :target: https://travis-ci.org/kezabelle/django-contextaware-processors\n\n.. |travis_master| image:: https://travis-ci.org/kezabelle/django-contextaware-processors.svg?branch=master\n  :target: https://travis-ci.org/kezabelle/django-contextaware-processors\n\n==============  ======\nRelease         Status\n==============  ======\nstable (0.1.1)  |travis_stable|\nmaster          |travis_master|\n==============  ======\n\n.. contents:: Sections\n   :depth: 3\n\nWhat it does\n------------\n\nEver used `Django`_ and wished you could have a `context processor`_ which\nreceived the existing context, along with the request, so that it could do\ndifferent things depending on the values the view provided? This does that, as\nlong as you're using `TemplateResponse`_ objects and not ``render()`` or\n``render_to_response()``.\n\nInstallation\n------------\n\nYou can use `pip`_ to install the ``0.1.1`` version from `PyPI`_::\n\n    pip install django-contextaware-processors==0.1.1\n\nOr you can grab it from  `GitHub`_  like this::\n\n  pip install -e git+https://github.com/kezabelle/django-contextaware-processors.git#egg=django-contextaware-processors\n\nUsage\n-----\n\nAdd a new ``CONTEXTAWARE_PROCESSORS`` setting to your project configuration. It\nshould be an iterable of strings representing the dotted paths to your\nprocessors, just the same as the `Django`_ context processors are configured::\n\n    CONTEXTAWARE_PROCESSORS = ('path.to.my_processor', 'another_processor.lives.here')\n\nProcessors are executed in the order in which they are declared, and update the\noriginal context data. The new context is given to subsequent processors, such\nthat the last processor above (``another_processor.lives.here``) will see any\nchanges made by ``path.to.my_processor``.\n\nUsing the middleware\n^^^^^^^^^^^^^^^^^^^^\n\nIn most cases, if you're using ``TemplateResponse`` objects (or any `Class\nBased View`_ which uses them for you), you want to use the provided\nmiddleware::\n\n    MIDDLEWARE_CLASSES = (\n        # ...\n        'contextaware_processors.middleware.ContextawareProcessors',\n        # ...\n    )\n\nAs this makes use of ``process_response(request, response)`` you probably want\nit somewhere near the bottom, so that it modifies the context on the way out\nas soon as possible. The middleware will automatically apply any processors\ndefined in ``CONTEXTAWARE_PROCESSORS``\n\nUsing the TemplateResponse subclass\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nFor custom situations, there is\n``context_processors.response.ContextawareTemplateResponse`` class which\nexposes an ``add_context_callback(callback_function)`` which can be used to\napply view-specific context modifiers, though why you'd need to is not\nimmeidiately obvious to me ;)\nIf the ``ContextawareProcessors`` middleware notices a ``ContextawareTemplateResponse`` it\nwill add those defined in ``CONTEXTAWARE_PROCESSORS`` *after* any previously\nregistered custom modifiers.\n\n\nWriting a context-aware processor\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe API contract for a processor is the same as a normal context processor, but\nwith the addition of a ``context`` parameter, sent as a *named-kwarg*.\n\nA normal context processor looks like::\n\n    def my_processor(request):\n        return {'MY_VALUE': 1}\n\nWhile a context-aware processor looks like::\n\n    def my_processor(request, context):\n        if 'MY_KEY' in context:\n            return {'MY_VALUE': 2}\n        return {'MY_VALUE': None}\n\nReturn values\n\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nA context-aware processor must return one of 3 things:\n- A ``dictionary`` to ``.update(...)`` the existing context with,\n- ``NotImplemented`` may be used to mark it as irrelevant for the request\n- For convienience, ``None`` may also be used to skip updating the context.\n\nSupported Django versions\n-------------------------\n\nThe tests are run against `Django`_ 1.8 through 1.10, and Python 2.7, 3.3, 3.4 and 3.5.\n\nRunning the tests\n^^^^^^^^^^^^^^^^^\n\nIf you have a cloned copy, you can do::\n\n  python setup.py test\n\nIf you have tox, you can just do::\n\n  tox\n\nContributing\n------------\n\nPlease do!\n\nThe project is hosted on `GitHub`_ in the `kezabelle/django-contextaware-processors`_\nrepository.\n\nBug reports and feature requests can be filed on the repository's `issue tracker`_.\n\nIf something can be discussed in 140 character chunks, there's also `my Twitter account`_.\n\nThe license\n-----------\n\nIt's `FreeBSD`_. There's should be a ``LICENSE`` file in the root of the repository, and in any archives.\n\n.. _FreeBSD: http://en.wikipedia.org/wiki/BSD_licenses#2-clause_license_.28.22Simplified_BSD_License.22_or_.22FreeBSD_License.22.29\n.. _Django: https://www.djangoproject.com/\n.. _Class Based View: https://docs.djangoproject.com/en/stable/topics/class-based-views/\n.. _context processor: https://docs.djangoproject.com/en/stable/topics/templates/#context-processors\n.. _TemplateResponse: https://docs.djangoproject.com/en/stable/ref/template-response/\n.. _GitHub: https://www.github.com/\n.. _kezabelle/django-contextaware-processors: https://www.github.com/kezabelle/django-contextaware-processors/\n.. _issue tracker: https://www.github.com/kezabelle/django-contextaware-processors/issues/\n.. _my Twitter account: https://www.twitter.com/kezabelle/\n.. _pip: https://pip.pypa.io/en/stable/\n.. _PyPI: https://pypi.python.org/pypi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkezabelle%2Fdjango-contextaware-processors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkezabelle%2Fdjango-contextaware-processors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkezabelle%2Fdjango-contextaware-processors/lists"}