Skip to main content

Pyramid Duh

Master Build:

build coverage

0.1 Build:

build-0.1 coverage-0.1

Documentation:

http://pyramid_duh.readthedocs.org/

Downloads:

http://pypi.python.org/pypi/pyramid_duh

Source:

https://github.com/stevearc/pyramid_duh

This is just a collection of utilities that I found myself putting into every single pyramid project I made. So now they’re all in one place.

Here’s a quick taste.

Don’t do this:

def register_user(request):
    username = request.POST['username']
    password = request.POST['password']
    birthdate = request.POST['birthdate']

Do this:

@argify(birthdate=date)
def register_user(request, username, password, birthdate):
    ...

What urls does this match?

@view_config(context=Root, name='package')
def get_or_list_packages(request):
    ...

Well, it matches

  • /package

  • /package/

  • /package/1234

  • /package/wait/hold/on

  • /package/this/seems/confusing

Whaaaat? Let’s fix that:

@view_config(context=Root, name='package', subpath=())
def list_packages(request):
    # return a list of packages

@view_config(context=Root, name='package', subpath=('id/*')
def get_package(request):
    package_id = request.named_subpaths['id']
    # fetch a single package

The first one matches

  • /package

  • /package/

The second matches

  • /package/*

  • /package/*/

But that still seems sloppy. You demand consistency!

@view_config(context=Root, name='package', subpath=())
@addslash
def list_packages(request):
    # return a list of packages

@view_config(context=Root, name='package', subpath=('id/*')
@addslash
def get_package(request):
    package_id = request.named_subpaths['id']
    # fetch a single package

Now it’s just /package/ and /package/*/

That’s the sales pitch. Read the docs for more details.

Changelog

0.1.2

  • Bug fix: Fix potential timezone issue when converting unix time to datetime

  • Using the ‘six’ library for python 2/3 compatibility

0.1.1

  • Bug fix: IStaticResource fails to look up self.request if nested 2-deep

  • Bug fix: Name collisions with version_helper.py

  • Bug fix: Subpath glob matching always respects case

  • Feature: @argify works on view classes

  • Feature: @argify can inject types that consume multiple parameters

  • Feature: Parameter types can be a dotted path

0.1.0

  • Package released into the wild

Metadata

Release files for pyramid_duh 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyramid_duh 0.1.2
File Size Uploaded Provenance
pyramid_duh-0.1.2.tar.gz 11.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyramid_duh 0.1.2
File Interpreter ABI Platform
pyramid_duh-0.1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 24.1 kB

Release files / pyramid_duh-0.1.2.tar.gz

Download URL pyramid_duh-0.1.2.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
347b60daaaa7ca52fefb262f2fb1bc924528aeca15aeea07e15a9fd272168b06
BLAKE2b-256 checksum
How to use checksums
6377a0125cfeaedcfebbfd7d4269dafc14e2c1a7b4cd9d35a20ed279081daa10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pyramid_duh-0.1.2-py2.py3-none-any.whl

Download URL pyramid_duh-0.1.2-py2.py3-none-any.whl
Size 13.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
85be0cc256588175df4926077e0da091d918f51dbe7f95a1c7a576845dfc6257
BLAKE2b-256 checksum
How to use checksums
1a4618ede3d6d841714f5f730b8ccf182659014d939f1976ce8980445b49ceae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pyramid_duh 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page