semvec/pypi-packages huggingface dataset:
django-future-url 0.2.2
Migration tool for django 1.4, fixes url template tag deprecation warnings.
License: MIT

django-future-url
=================

.. image:: https://travis-ci.org/futurecolors/django-future-url.png?branch=master
        :target: https://travis-ci.org/futurecolors/django-future-url

Migration tool for old style “url” tags in Django 1.3 & 1.4.
Support for Django 1.5 in next version.
`“In Django 1.5, the behavior of the url template tag will change”`_

If you use old style url tags in django 1.4 you will see that:
“DeprecationWarning: The syntax for the url template tag is changing.
Load the ``url`` tag from the ``future`` tag library to start using the
new behavior.”

The new library also drops support for the comma syntax
for separating arguments to the url template tag.

In Django 1.5, the old behavior will be replaced with the behavior
provided by the future tag library. Existing templates be migrated to use the new syntax.

.. _“In Django 1.5, the behavior of the url template tag will change”: https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#url

How it works
------------

-  Finds all ``\*.html``, ``\*.txt`` files.
-  Replaces all old style “url” tags.
-  Inserts ``{% load url from future %}`` when it's needed.

Installation
------------
::

    $ pip install django-future-url

Usage
-----
::

    $ cd ~/projects/my_django_14_project/
    $ future_url

It will show needed midification for all templates in directory
“~/projects/my\_django\_14\_project/” and subdirectories.::

    $ future_url --write

It will modernize all your templates in place (see above).

Options
~~~~~~~

You can use ``future_url --help`` for help.

Only shows changes to be made without actually modifying files::

    $ future_url


Example
-------
::

    $ cat ./template1.html

    {% url path.to.view arg arg2 %}
    {%  url path.to.view arg arg2 %}
    {%url myapp:view-name %}
    {% url path.to.view as the_url%}
    {% url   path.to.view arg arg2   as   the_url %}
    {%url app_views.client client.id%}

::

    $ future_url --write

    $ cat ./template1.html

    {% load url from future %}
    {% url 'path.to.view' arg arg2 %}
    {%  url 'path.to.view' arg arg2 %}
    {%url 'myapp:view-name' %}
    {% url 'path.to.view' as the_url%}
    {% url   'path.to.view' arg arg2   as   the_url %}


Tests
-----

Install ``python setup.py test`` and ``cram django_future_url/test/cram``
sqlalchemy_traversal 0.5.2
UNKNOWN
License: MIT

sqlalchemy_traversal
====================

This is a pyramid extension that allows you to use traversal with SQLAlchemy objects

Demo App here: https://github.com/eventray/sqlalchemy_traversal_demo

To use this you just have to include sqlalchemy_traversal in your pyramid application
by either putting it in your development.ini:

    pyramid.includes = 
        sqlalchemy_traversal

or by including it in your main:

    config.include('sqlalchemy_traversal')


Then you just register your SQLAlchemy session and declarative base:

    from sqlalchemy_traversal.interfaces import ISASession
    from sqlalchemy_traversal.interfaces import ISABase

    config.registry.registerUtility(DBSession, ISASession)
    config.registry.registerUtility(Base, ISABase)


And then place the TraversalMixin on any SQLAlchemy class and it will automatically
be traversed:

    from sqlalchemy_traversal import TraversalMixin
    
    
    class User(TraversalMixin, Base):
        pass


Now you will be able to hit the URL /traverse/user  to get all the users in your database


You can also tell it to load relationships via the _json_eager_load property:

    class User(TraversalMixin, Base):
        _json_eager_load = ['permissions']


Saving
==================================
If you want to be able to create data with your API but the content
coming back doesn't exactly match your model or you want to run it through
schema validation first you can use the register save decorator:

    @register_save(MyModel, MySchema):
    def saving_my_model(request, data):
        data['my_prop'] = 'NEW DATA'
        return data

You can also handle data exceptions with exception_handlers:

    def handle_integrity_error(model, exception):
        return {
            'errors': {
                'message': 'That data is not unique'
            }
        }

    @register_save(
        MyModel
        , MySchema
        , exception_handlers={
            IntegrityError: handle_integrity_error
        }
    ):
    def saving_my_model(request, data):
        data['my_prop'] = 'NEW DATA'
        return data