forked from ScoDoc/ScoDoc
tmp
This commit is contained in:
parent
e1f36d9484
commit
893b523b17
|
@ -31,6 +31,7 @@ Module main: page d'accueil, avec liste des départements
|
|||
Emmanuel Viennet, 2021
|
||||
"""
|
||||
from app.models import ScoDocSiteConfig
|
||||
from app.scodoc.sco_logos import write_logo, find_logo
|
||||
|
||||
|
||||
class Action:
|
||||
|
@ -41,7 +42,7 @@ class Action:
|
|||
self.parameters = parameters
|
||||
|
||||
@staticmethod
|
||||
def get_action(parameters):
|
||||
def get_action(parameters, stream=None):
|
||||
"""Check (from parameters) if some action has to be done and
|
||||
then return list of action (or else return empty list)."""
|
||||
raise NotImplementedError
|
||||
|
@ -75,7 +76,14 @@ class LogoUpdate(Action):
|
|||
return []
|
||||
|
||||
def execute(self):
|
||||
raise NotImplementedError
|
||||
logo = find_logo(
|
||||
dept_id=self.parameters["dept_id"], logoname=self.parameters["logo_id"]
|
||||
)
|
||||
write_logo(
|
||||
stream=self.parameters["upload"],
|
||||
dept_id=self.parameters["dept_id"],
|
||||
name=self.parameters["logo_id"],
|
||||
)
|
||||
|
||||
|
||||
class LogoDelete(Action):
|
||||
|
|
|
@ -127,6 +127,9 @@ class AddLogoForm(FlaskForm):
|
|||
kwargs["meta"] = {"csrf": False}
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def get_action(self, add_data):
|
||||
return LogoInsert.get_action(add_data)
|
||||
|
||||
|
||||
class LogoForm(FlaskForm):
|
||||
"""Embed both presentation of a logo (cf. template file configuration.html)
|
||||
|
@ -156,8 +159,7 @@ class LogoForm(FlaskForm):
|
|||
self.logo = modele
|
||||
self.do_delete.data = False
|
||||
|
||||
@staticmethod
|
||||
def get_actions(logo_data):
|
||||
def get_actions(self, logo_data):
|
||||
actions = []
|
||||
actions += LogoDelete.get_action(logo_data)
|
||||
actions += LogoUpdate.get_action(logo_data)
|
||||
|
@ -310,6 +312,7 @@ class ScoDocConfigurationForm(FlaskForm):
|
|||
return dept_form.get_form(logoname)
|
||||
|
||||
def get_actions(self, data):
|
||||
breakpoint()
|
||||
actions = []
|
||||
if BonusSportUpdate.get_action(data):
|
||||
actions.append(BonusSportUpdate(data))
|
||||
|
|
Loading…
Reference in New Issue
Block a user