Releases: marcuxyz/mvc-flask
v2.11.1
v2.11.0
v2.10.0
What's Changed
- Bump jinja2 from 3.1.2 to 3.1.3 by @dependabot in #57
- Bump black from 23.11.0 to 24.3.0 by @dependabot in #58
Full Changelog: v2.9.0...v2.10.0
v.2.9.0
What's Changed
Previously you could only run callbacks for all routes. For example,
Before:
from flask import render_template
before_request = ["set_user"]
def index(self):
return render_template('users/index.html', user=self.user)
def show(self):
return render_template('users/show.html', user=self.user)
def set_user(self):
self.user = 'Joe'
To both routes index
and show
you can call self.user
.
Now, you can use dict structure to control the before_request
callback.
before_request = dict(callback="set_user", actions="show")
See:
from flask import render_template
before_request = dict(callback="set_user", actions="show")
def index(self):
# self.user is not implemented here
return render_template('users/index.html')
def show(self):
return render_template('users/show.html', user=self.user)
def set_user(self):
self.user = 'Joe'
Now you can invoke the callback only on the action of your choice
Full Changelog: v2.8.3...v2.9.0
v2.8.3
v2.8.2
v2.8.1
v2.7.2
v2.7.1
What's Changed
- Create a documentation for MVC-Flask by @marcuxyz in #39
- Refactor the code, create documentation to code, and update tests by @marcuxyz in #43
Description
Test Improvements and Refactoring:
New test cases were added to validate the registration of blueprints, routes, endpoints, and HTTP verbs.
The tests in routes_test.py were refactored for better readability and maintainability. This included removing unused properties and simplifying tests by directly comparing expected and actual blueprints, routes, and methods.
Version Update and Tests:
The package version was updated from 2.5.0 to 2.7.0, with a corresponding unit test added to verify this change.
Test Setup and File Management:
A conftest.py file was added for test fixtures and client setup, replacing the fixtures.py file. Additionally, the messages_endpoint_test.py file was added for testing message endpoints, while the request_test.py file was removed.
Makefile and Dependency Updates:
The Makefile was updated to use pytest instead of ward and to change the line length limit to 89 characters for consistency. Flask-SQLAlchemy and pytest were added as dev dependencies.
Router Class Addition:
A Router class was added to manage different HTTP routes (GET, POST, PUT, DELETE) for the application's controllers and actions.
Additional Test Cases and Cleanup:
New tests were added for checking blueprints registration, message routes, and endpoints. Unnecessary blank lines were removed to improve code readability. Tests were also added to ensure proper registration of routes and methods count.
HTTP Method Override Functionality:
The http_method_override.py file was added to handle HTTP method override functionality with new HTTPMethodOverrideMiddleware and CustomRequest classes.
Controller and Route Management:
The messages_controller.py was refactored to handle both JSON and form data for updating message titles. Unused methods and files in the controllers were removed, and new methods were added to improve code organization and readability.
Full Changelog: v2.7.0...v2.7.1