Skip to content

🐺 Python implementation of Domain Notification Pattern based in Flunt(.NET), JFlunt(Java) developed by @andrebaltieri, @carlosbritojun

License

Notifications You must be signed in to change notification settings

flaviogf/pyflunt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyflunt

Project   |    Techs   |    How to use   |    License

🚀 Project

🐺 Python implementation of Domain Notification Pattern based in Flunt(.NET), JFlunt(Java) developed by @andrebaltieri, @carlosbritojun

💻 Techs

🤔 How to use

Installation

pip install pyflunt

Notifiable

from pyflunt.notifications import Notifiable, Notification

class Name(Notifiable):
    def __init__(self, name):
        super().__init__()
        
        if len(name) > 3:
            self.add_notification(Notification(field='name', message='invalid name'))

        self._name = name

Contract

from pyflunt.notifications import Notifiable
from pyflunt.validations import Contract

class Email(Notifiable):
    def __init__(self, email):
        super().__init__()

        self._email = email

        contract = (Contract().requires()
                              .has_max_len(value=email,
                                           maximum=50,
                                           message='invalid email')
                              .is_email(value=email,
                                        field='email',
                                        message='invalid email'))

        self.add_notifications(contract)

📝 License

This project contains the MIT license. See the file LICENSE.

About

🐺 Python implementation of Domain Notification Pattern based in Flunt(.NET), JFlunt(Java) developed by @andrebaltieri, @carlosbritojun

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages