pyeve / eve-sqlalchemy

SQLAlchemy data layer for Eve-powered RESTful APIs
http://eve-sqlalchemy.readthedocs.io
Other
234 stars 70 forks source link

Bad `url` field in documentation #108

Closed KillianKemps closed 7 years ago

KillianKemps commented 8 years ago

Hello,

In your tutorial (https://eve-sqlalchemy.readthedocs.org/en/stable/tutorial.html), you got this snippet:

# but you can always customize it:
DOMAIN['people'].update({
    'item_title': 'person',
    'additional_lookup': {
        'url': '[0-9]+',
        'field': 'id'
        },
    'cache_control': 'max-age=10,must-revalidate',
    'cache_expires': 10,
    'resource_methods': ['GET', 'POST', 'DELETE']
    })

However, the url field is not correct and raises an exception :

Traceback (most recent call last):
ValueError: malformed url rule: '/my-resource/<[0-9]+:my_resource>'

In fact, it should be this instead (in my case, it solved the issue):

    'additional_lookup': {
        'url': 'regex("[0-9]+")',
        'field': 'my_resource'
        },
mandarvaze commented 8 years ago

@KillianKemps can you send a PR ? (Since you already know the fix)

KillianKemps commented 8 years ago

@mandarvaze PR sent! :)