Giter Site home page Giter Site logo

Custom backend feature about django-mjml HOT 6 OPEN

liminspace avatar liminspace commented on June 25, 2024 2
Custom backend feature

from django-mjml.

Comments (6)

liminspace avatar liminspace commented on June 25, 2024

@2tunnels hi! it sounds ok, but your custom_renderer is already implemented as httpserver mode :)
It can be a minor feature in the future, but I don't see any reason to implement it right now. People usually uses one of the three modes and if they use something custom, the just implement their server for httpserver mode. I want to keep the library as simple and small as possible.

from django-mjml.

2tunnels avatar 2tunnels commented on June 25, 2024

Yes, but HTTP server implementation is hardcoded. Let's say I want to use protobuf instead of JSON, or my request body looks a little different. Or I want to do custom authentication with another header.
This feature will not break anything because it's just an additional check (after cmd, tcpserver and httpserver), and the only thing we need to check if this new string is importable and callable.

from django-mjml.

liminspace avatar liminspace commented on June 25, 2024

I think it will be better to implement class-based backend pattern. I'll think about it.

from django-mjml.

2tunnels avatar 2tunnels commented on June 25, 2024

Sounds good! But will callable approach you can use both functions and classes (classes that implement __call__ method).
It's your decision, just saying that function is the simplest API abstraction you can have 😇

from django-mjml.

liminspace avatar liminspace commented on June 25, 2024

I thing class is better because I want to support multiple backends and one backend will be able to initiate with different settings and it also allow the beckend to use instance variables to use caching, collect stats, keeping connections and so on.

from django-mjml.

2tunnels avatar 2tunnels commented on June 25, 2024

If you want to separate configuration and execution steps, yes, class approach makes more sense.

from django-mjml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.