Skip to main content

🚀 Simpel Hookup

Simpel function hook for Django. Install :

pip install simpel-hookup

Simpel hookup secara otomatis akan mencari hooks.py di dalam setiap aplikasi Django yang terinstall dalam project.

Registrasi hooks

# app/hooks.py

import simpel_hookup as hookup

@hookup.register("PROCESS_TEXT_HOOKS", order=1)
def process_text_replace_space(text):
    text = text.replace(" ", "-")
    print(text)
    return text

@hookup.register("PROCESS_TEXT_HOOKS", order=2)
def process_text_replace_dash(text):
    text = text.replace("-", "_")
    print(text)
    return text

Memanggil hook

# app/views.py
from django.http.response import HttpResponse
import simpel_hookup as hookup

def index(request):
    text = "Lorem ipsum dolor sit amet"

    hook_funcs = hookup.get_hooks('PROCESS_TEXT_HOOKS')
    for func in hook_funcs:
        text = func(text)

    return HttpResponse(text)

Metadata

Release files for simpel-hookup 0.1

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

Source distribution (sdist)

Source distribution for simpel-hookup 0.1
File Size Uploaded
simpel-hookup-0.1.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simpel-hookup 0.1
File Interpreter ABI Platform
simpel_hookup-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.4 kB

Release files / simpel-hookup-0.1.tar.gz

Download URL simpel-hookup-0.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
18d35d38d2e35e0173f1782c4f38ea2665c998ef89945bde84b428c2c6b86574
BLAKE2b-256 checksum
How to use checksums
a5e0f200e48171ad20747531e7ce8da2f791046dde616cc1f8f9d0f462dc81cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.27.1 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release files / simpel_hookup-0.1-py3-none-any.whl

Download URL simpel_hookup-0.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da50abd9a2e3fcae92aa2ac113bacf36d1a3a620c06e50f7fe6f5db783184bde
BLAKE2b-256 checksum
How to use checksums
d3d3497988953bd10d66705144ea5849ef2c5bbb50b97a96a21ebb97fae102cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.27.1 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

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