1
0
forked from ScoDoc/ScoDoc

fix diffs avec origin master

This commit is contained in:
leonard_montalbano 2022-07-11 13:39:50 +02:00
parent c021572a1a
commit 4b00a5c8ff
26 changed files with 237 additions and 445 deletions

0
LICENSE Executable file → Normal file
View File

0
README.md Executable file → Normal file
View File

View File

@ -451,7 +451,6 @@ class ApcAppCritique(db.Model, XMLModel):
if competence is not None:
query = query.filter(ApcNiveau.competence == competence)
return query
<<<<<<< HEAD
def __init__(self, id, niveau_id, code, libelle, modules):
self.id = id
@ -459,8 +458,6 @@ class ApcAppCritique(db.Model, XMLModel):
self.code = code
self.libelle = libelle
self.modules = modules
=======
>>>>>>> 7c340c798ad59c41653efc83bfd079f11fce1938
def to_dict(self) -> dict:
return {"libelle": self.libelle}
@ -547,14 +544,11 @@ class ApcAnneeParcours(db.Model, XMLModel):
)
ordre = db.Column(db.Integer)
"numéro de l'année: 1, 2, 3"
<<<<<<< HEAD
def __init__(self, id, parcours_id, ordre):
self.id = id
self.parcours_id = parcours_id
self.ordre = ordre
=======
>>>>>>> 7c340c798ad59c41653efc83bfd079f11fce1938
def __repr__(self):
return f"<{self.__class__.__name__} {self.id} ordre={self.ordre!r} parcours={self.parcours.code!r}>"

View File

@ -121,7 +121,8 @@ def _list_dept_logos(dept_id=None, prefix=scu.LOGO_FILE_PREFIX):
:return: le résultat de la recherche ou None si aucune image trouvée
"""
allowed_ext = "|".join(scu.LOGOS_IMAGES_ALLOWED_TYPES)
filename_parser = re.compile(f"{prefix}([^.]*).({allowed_ext})")
# parse filename 'logo_<logoname>.<ext> . be carefull: logoname may include '.'
filename_parser = re.compile(f"{prefix}(([^.]*.)+)({allowed_ext})")
logos = {}
path_dir = Path(scu.SCODOC_LOGOS_DIR)
if dept_id:
@ -135,7 +136,7 @@ def _list_dept_logos(dept_id=None, prefix=scu.LOGO_FILE_PREFIX):
if os.access(path_dir.joinpath(entry).absolute(), os.R_OK):
result = filename_parser.match(entry.name)
if result:
logoname = result.group(1)
logoname = result.group(1)[:-1] # retreive logoname from filename (less final dot)
logos[logoname] = Logo(logoname=logoname, dept_id=dept_id).select()
return logos if len(logos.keys()) > 0 else None
@ -191,6 +192,9 @@ class Logo:
)
self.mm = "Not initialized: call the select or create function before access"
def __repr__(self) -> str:
return f"Logo(logoname='{self.logoname}', filename='{self.filename}')"
def _set_format(self, fmt):
self.suffix = fmt
self.filepath = self.basepath + "." + fmt

0
bench.py Executable file → Normal file
View File

View File

@ -14,17 +14,17 @@ config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)
logger = logging.getLogger("alembic.env")
logger = logging.getLogger('alembic.env')
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
config.set_main_option(
"sqlalchemy.url",
str(current_app.extensions["migrate"].db.get_engine().url).replace("%", "%%"),
)
target_metadata = current_app.extensions["migrate"].db.metadata
'sqlalchemy.url',
str(current_app.extensions['migrate'].db.get_engine().url).replace(
'%', '%%'))
target_metadata = current_app.extensions['migrate'].db.metadata
# other values from the config, defined by the needs of env.py,
# can be acquired:
@ -45,7 +45,9 @@ def run_migrations_offline():
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(url=url, target_metadata=target_metadata, literal_binds=True)
context.configure(
url=url, target_metadata=target_metadata, literal_binds=True
)
with context.begin_transaction():
context.run_migrations()
@ -63,20 +65,20 @@ def run_migrations_online():
# when there are no changes to the schema
# reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
def process_revision_directives(context, revision, directives):
if getattr(config.cmd_opts, "autogenerate", False):
if getattr(config.cmd_opts, 'autogenerate', False):
script = directives[0]
if script.upgrade_ops.is_empty():
directives[:] = []
logger.info("No changes in schema detected.")
logger.info('No changes in schema detected.')
connectable = current_app.extensions["migrate"].db.get_engine()
connectable = current_app.extensions['migrate'].db.get_engine()
with connectable.connect() as connection:
context.configure(
connection=connection,
target_metadata=target_metadata,
process_revision_directives=process_revision_directives,
**current_app.extensions["migrate"].configure_args
**current_app.extensions['migrate'].configure_args
)
with context.begin_transaction():

View File

@ -10,23 +10,21 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "017e32eb4773"
down_revision = "6b071b7947e5"
revision = '017e32eb4773'
down_revision = '6b071b7947e5'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("identite", sa.Column("scodoc7_id", sa.Text(), nullable=True))
op.add_column(
"notes_formsemestre", sa.Column("scodoc7_id", sa.Text(), nullable=True)
)
op.add_column('identite', sa.Column('scodoc7_id', sa.Text(), nullable=True))
op.add_column('notes_formsemestre', sa.Column('scodoc7_id', sa.Text(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("notes_formsemestre", "scodoc7_id")
op.drop_column("identite", "scodoc7_id")
op.drop_column('notes_formsemestre', 'scodoc7_id')
op.drop_column('identite', 'scodoc7_id')
# ### end Alembic commands ###

View File

@ -10,38 +10,21 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "1efe07413835"
down_revision = "75cf18659984"
revision = '1efe07413835'
down_revision = '75cf18659984'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"absences_notifications_formsemestre_id_fkey",
"absences_notifications",
type_="foreignkey",
)
op.create_foreign_key(
None,
"absences_notifications",
"notes_formsemestre",
["formsemestre_id"],
["id"],
ondelete="CASCADE",
)
op.drop_constraint('absences_notifications_formsemestre_id_fkey', 'absences_notifications', type_='foreignkey')
op.create_foreign_key(None, 'absences_notifications', 'notes_formsemestre', ['formsemestre_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "absences_notifications", type_="foreignkey")
op.create_foreign_key(
"absences_notifications_formsemestre_id_fkey",
"absences_notifications",
"notes_formsemestre",
["formsemestre_id"],
["id"],
)
op.drop_constraint(None, 'absences_notifications', type_='foreignkey')
op.create_foreign_key('absences_notifications_formsemestre_id_fkey', 'absences_notifications', 'notes_formsemestre', ['formsemestre_id'], ['id'])
# ### end Alembic commands ###

View File

@ -10,57 +10,25 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "39818df276aa"
down_revision = "1efe07413835"
revision = '39818df276aa'
down_revision = '1efe07413835'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"itemsuivi_tags_assoc_tag_id_fkey", "itemsuivi_tags_assoc", type_="foreignkey"
)
op.drop_constraint(
"itemsuivi_tags_assoc_itemsuivi_id_fkey",
"itemsuivi_tags_assoc",
type_="foreignkey",
)
op.create_foreign_key(
None,
"itemsuivi_tags_assoc",
"itemsuivi",
["itemsuivi_id"],
["id"],
ondelete="CASCADE",
)
op.create_foreign_key(
None,
"itemsuivi_tags_assoc",
"itemsuivi_tags",
["tag_id"],
["id"],
ondelete="CASCADE",
)
op.drop_constraint('itemsuivi_tags_assoc_tag_id_fkey', 'itemsuivi_tags_assoc', type_='foreignkey')
op.drop_constraint('itemsuivi_tags_assoc_itemsuivi_id_fkey', 'itemsuivi_tags_assoc', type_='foreignkey')
op.create_foreign_key(None, 'itemsuivi_tags_assoc', 'itemsuivi', ['itemsuivi_id'], ['id'], ondelete='CASCADE')
op.create_foreign_key(None, 'itemsuivi_tags_assoc', 'itemsuivi_tags', ['tag_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "itemsuivi_tags_assoc", type_="foreignkey")
op.drop_constraint(None, "itemsuivi_tags_assoc", type_="foreignkey")
op.create_foreign_key(
"itemsuivi_tags_assoc_itemsuivi_id_fkey",
"itemsuivi_tags_assoc",
"itemsuivi",
["itemsuivi_id"],
["id"],
)
op.create_foreign_key(
"itemsuivi_tags_assoc_tag_id_fkey",
"itemsuivi_tags_assoc",
"itemsuivi_tags",
["tag_id"],
["id"],
)
op.drop_constraint(None, 'itemsuivi_tags_assoc', type_='foreignkey')
op.drop_constraint(None, 'itemsuivi_tags_assoc', type_='foreignkey')
op.create_foreign_key('itemsuivi_tags_assoc_itemsuivi_id_fkey', 'itemsuivi_tags_assoc', 'itemsuivi', ['itemsuivi_id'], ['id'])
op.create_foreign_key('itemsuivi_tags_assoc_tag_id_fkey', 'itemsuivi_tags_assoc', 'itemsuivi_tags', ['tag_id'], ['id'])
# ### end Alembic commands ###

View File

@ -10,24 +10,19 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "669065fb2d20"
down_revision = "a217bf588f4c"
revision = '669065fb2d20'
down_revision = 'a217bf588f4c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"notes_formsemestre",
sa.Column(
"block_moyennes", sa.Boolean(), server_default="false", nullable=False
),
)
op.add_column('notes_formsemestre', sa.Column('block_moyennes', sa.Boolean(), server_default='false', nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("notes_formsemestre", "block_moyennes")
op.drop_column('notes_formsemestre', 'block_moyennes')
# ### end Alembic commands ###

View File

@ -10,31 +10,25 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "6b071b7947e5"
down_revision = "993ce4a01d57"
revision = '6b071b7947e5'
down_revision = '993ce4a01d57'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"notes_modules",
"code",
op.alter_column('notes_modules', 'code',
existing_type=sa.VARCHAR(length=32),
type_=sa.Text(),
existing_nullable=False,
)
existing_nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"notes_modules",
"code",
op.alter_column('notes_modules', 'code',
existing_type=sa.Text(),
type_=sa.VARCHAR(length=32),
existing_nullable=False,
)
existing_nullable=False)
# ### end Alembic commands ###

View File

@ -10,33 +10,26 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "6cfc21a7ae1b"
down_revision = "ada0d1f3d84f"
revision = '6cfc21a7ae1b'
down_revision = 'ada0d1f3d84f'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"module_ue_coef",
sa.Column("module_id", sa.Integer(), nullable=False),
sa.Column("ue_id", sa.Integer(), nullable=False),
sa.Column("coef", sa.Float(), nullable=False),
sa.ForeignKeyConstraint(
["module_id"],
["notes_modules.id"],
),
sa.ForeignKeyConstraint(
["ue_id"],
["notes_ue.id"],
),
sa.PrimaryKeyConstraint("module_id", "ue_id"),
op.create_table('module_ue_coef',
sa.Column('module_id', sa.Integer(), nullable=False),
sa.Column('ue_id', sa.Integer(), nullable=False),
sa.Column('coef', sa.Float(), nullable=False),
sa.ForeignKeyConstraint(['module_id'], ['notes_modules.id'], ),
sa.ForeignKeyConstraint(['ue_id'], ['notes_ue.id'], ),
sa.PrimaryKeyConstraint('module_id', 'ue_id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("module_ue_coef")
op.drop_table('module_ue_coef')
# ### end Alembic commands ###

View File

@ -10,50 +10,25 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "75cf18659984"
down_revision = "d74b4e16fb3c"
revision = '75cf18659984'
down_revision = 'd74b4e16fb3c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"notes_modules_tags_tag_id_fkey", "notes_modules_tags", type_="foreignkey"
)
op.drop_constraint(
"notes_modules_tags_module_id_fkey", "notes_modules_tags", type_="foreignkey"
)
op.create_foreign_key(
None, "notes_modules_tags", "notes_tags", ["tag_id"], ["id"], ondelete="CASCADE"
)
op.create_foreign_key(
None,
"notes_modules_tags",
"notes_modules",
["module_id"],
["id"],
ondelete="CASCADE",
)
op.drop_constraint('notes_modules_tags_tag_id_fkey', 'notes_modules_tags', type_='foreignkey')
op.drop_constraint('notes_modules_tags_module_id_fkey', 'notes_modules_tags', type_='foreignkey')
op.create_foreign_key(None, 'notes_modules_tags', 'notes_tags', ['tag_id'], ['id'], ondelete='CASCADE')
op.create_foreign_key(None, 'notes_modules_tags', 'notes_modules', ['module_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "notes_modules_tags", type_="foreignkey")
op.drop_constraint(None, "notes_modules_tags", type_="foreignkey")
op.create_foreign_key(
"notes_modules_tags_module_id_fkey",
"notes_modules_tags",
"notes_modules",
["module_id"],
["id"],
)
op.create_foreign_key(
"notes_modules_tags_tag_id_fkey",
"notes_modules_tags",
"notes_tags",
["tag_id"],
["id"],
)
op.drop_constraint(None, 'notes_modules_tags', type_='foreignkey')
op.drop_constraint(None, 'notes_modules_tags', type_='foreignkey')
op.create_foreign_key('notes_modules_tags_module_id_fkey', 'notes_modules_tags', 'notes_modules', ['module_id'], ['id'])
op.create_foreign_key('notes_modules_tags_tag_id_fkey', 'notes_modules_tags', 'notes_tags', ['tag_id'], ['id'])
# ### end Alembic commands ###

View File

@ -10,77 +10,46 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "92789d50f6b6"
down_revision = "00ad500fb118"
revision = '92789d50f6b6'
down_revision = '00ad500fb118'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("modules_acs")
op.drop_table("app_crit")
op.add_column("apc_annee_parcours", sa.Column("ordre", sa.Integer(), nullable=True))
op.drop_column("apc_annee_parcours", "numero")
op.create_index(
op.f("ix_apc_app_critique_code"), "apc_app_critique", ["code"], unique=False
)
op.create_unique_constraint(
"apc_competence_referentiel_id_titre_key",
"apc_competence",
["referentiel_id", "titre"],
)
op.create_index(
op.f("ix_apc_competence_titre"), "apc_competence", ["titre"], unique=False
)
op.add_column(
"apc_referentiel_competences",
sa.Column("scodoc_date_loaded", sa.DateTime(), nullable=True),
)
op.add_column(
"apc_referentiel_competences",
sa.Column("scodoc_orig_filename", sa.Text(), nullable=True),
)
op.drop_table('modules_acs')
op.drop_table('app_crit')
op.add_column('apc_annee_parcours', sa.Column('ordre', sa.Integer(), nullable=True))
op.drop_column('apc_annee_parcours', 'numero')
op.create_index(op.f('ix_apc_app_critique_code'), 'apc_app_critique', ['code'], unique=False)
op.create_unique_constraint('apc_competence_referentiel_id_titre_key', 'apc_competence', ['referentiel_id', 'titre'])
op.create_index(op.f('ix_apc_competence_titre'), 'apc_competence', ['titre'], unique=False)
op.add_column('apc_referentiel_competences', sa.Column('scodoc_date_loaded', sa.DateTime(), nullable=True))
op.add_column('apc_referentiel_competences', sa.Column('scodoc_orig_filename', sa.Text(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("apc_referentiel_competences", "scodoc_orig_filename")
op.drop_column("apc_referentiel_competences", "scodoc_date_loaded")
op.drop_index(op.f("ix_apc_competence_titre"), table_name="apc_competence")
op.drop_constraint(
"apc_competence_referentiel_id_titre_key", "apc_competence", type_="unique"
op.drop_column('apc_referentiel_competences', 'scodoc_orig_filename')
op.drop_column('apc_referentiel_competences', 'scodoc_date_loaded')
op.drop_index(op.f('ix_apc_competence_titre'), table_name='apc_competence')
op.drop_constraint('apc_competence_referentiel_id_titre_key', 'apc_competence', type_='unique')
op.drop_index(op.f('ix_apc_app_critique_code'), table_name='apc_app_critique')
op.add_column('apc_annee_parcours', sa.Column('numero', sa.INTEGER(), autoincrement=False, nullable=True))
op.drop_column('apc_annee_parcours', 'ordre')
op.create_table('app_crit',
sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('app_crit_id_seq'::regclass)"), autoincrement=True, nullable=False),
sa.Column('code', sa.TEXT(), autoincrement=False, nullable=False),
sa.Column('titre', sa.TEXT(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='app_crit_pkey'),
postgresql_ignore_search_path=False
)
op.drop_index(op.f("ix_apc_app_critique_code"), table_name="apc_app_critique")
op.add_column(
"apc_annee_parcours",
sa.Column("numero", sa.INTEGER(), autoincrement=False, nullable=True),
)
op.drop_column("apc_annee_parcours", "ordre")
op.create_table(
"app_crit",
sa.Column(
"id",
sa.INTEGER(),
server_default=sa.text("nextval('app_crit_id_seq'::regclass)"),
autoincrement=True,
nullable=False,
),
sa.Column("code", sa.TEXT(), autoincrement=False, nullable=False),
sa.Column("titre", sa.TEXT(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint("id", name="app_crit_pkey"),
postgresql_ignore_search_path=False,
)
op.create_table(
"modules_acs",
sa.Column("module_id", sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column("ac_id", sa.INTEGER(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(
["ac_id"], ["app_crit.id"], name="modules_acs_ac_id_fkey"
),
sa.ForeignKeyConstraint(
["module_id"], ["notes_modules.id"], name="modules_acs_module_id_fkey"
),
op.create_table('modules_acs',
sa.Column('module_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('ac_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['ac_id'], ['app_crit.id'], name='modules_acs_ac_id_fkey'),
sa.ForeignKeyConstraint(['module_id'], ['notes_modules.id'], name='modules_acs_module_id_fkey')
)
# ### end Alembic commands ###

View File

@ -10,50 +10,27 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "a217bf588f4c"
down_revision = "f73251d1d825"
revision = 'a217bf588f4c'
down_revision = 'f73251d1d825'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"notes_semset_formsemestre",
"semset_id",
op.alter_column('notes_semset_formsemestre', 'semset_id',
existing_type=sa.INTEGER(),
nullable=False,
)
op.drop_constraint(
"notes_semset_formsemestre_semset_id_fkey",
"notes_semset_formsemestre",
type_="foreignkey",
)
op.create_foreign_key(
None,
"notes_semset_formsemestre",
"notes_semset",
["semset_id"],
["id"],
ondelete="CASCADE",
)
nullable=False)
op.drop_constraint('notes_semset_formsemestre_semset_id_fkey', 'notes_semset_formsemestre', type_='foreignkey')
op.create_foreign_key(None, 'notes_semset_formsemestre', 'notes_semset', ['semset_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "notes_semset_formsemestre", type_="foreignkey")
op.create_foreign_key(
"notes_semset_formsemestre_semset_id_fkey",
"notes_semset_formsemestre",
"notes_semset",
["semset_id"],
["id"],
)
op.alter_column(
"notes_semset_formsemestre",
"semset_id",
op.drop_constraint(None, 'notes_semset_formsemestre', type_='foreignkey')
op.create_foreign_key('notes_semset_formsemestre_semset_id_fkey', 'notes_semset_formsemestre', 'notes_semset', ['semset_id'], ['id'])
op.alter_column('notes_semset_formsemestre', 'semset_id',
existing_type=sa.INTEGER(),
nullable=True,
)
nullable=True)
# ### end Alembic commands ###

View File

@ -10,23 +10,21 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "c8efc54586d8"
down_revision = "6cfc21a7ae1b"
revision = 'c8efc54586d8'
down_revision = '6cfc21a7ae1b'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("notes_ue", sa.Column("semestre_idx", sa.Integer(), nullable=True))
op.create_index(
op.f("ix_notes_ue_semestre_idx"), "notes_ue", ["semestre_idx"], unique=False
)
op.add_column('notes_ue', sa.Column('semestre_idx', sa.Integer(), nullable=True))
op.create_index(op.f('ix_notes_ue_semestre_idx'), 'notes_ue', ['semestre_idx'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_notes_ue_semestre_idx"), table_name="notes_ue")
op.drop_column("notes_ue", "semestre_idx")
op.drop_index(op.f('ix_notes_ue_semestre_idx'), table_name='notes_ue')
op.drop_column('notes_ue', 'semestre_idx')
# ### end Alembic commands ###

View File

@ -10,25 +10,23 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "d3d92b2d0092"
down_revision = "017e32eb4773"
revision = 'd3d92b2d0092'
down_revision = '017e32eb4773'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("itemsuivi_tags", sa.Column("dept_id", sa.Integer(), nullable=True))
op.create_index(
op.f("ix_itemsuivi_tags_dept_id"), "itemsuivi_tags", ["dept_id"], unique=False
)
op.create_foreign_key(None, "itemsuivi_tags", "departement", ["dept_id"], ["id"])
op.add_column('itemsuivi_tags', sa.Column('dept_id', sa.Integer(), nullable=True))
op.create_index(op.f('ix_itemsuivi_tags_dept_id'), 'itemsuivi_tags', ['dept_id'], unique=False)
op.create_foreign_key(None, 'itemsuivi_tags', 'departement', ['dept_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "itemsuivi_tags", type_="foreignkey")
op.drop_index(op.f("ix_itemsuivi_tags_dept_id"), table_name="itemsuivi_tags")
op.drop_column("itemsuivi_tags", "dept_id")
op.drop_constraint(None, 'itemsuivi_tags', type_='foreignkey')
op.drop_index(op.f('ix_itemsuivi_tags_dept_id'), table_name='itemsuivi_tags')
op.drop_column('itemsuivi_tags', 'dept_id')
# ### end Alembic commands ###

View File

@ -10,73 +10,49 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f6e7d2e01be1"
down_revision = "d3d92b2d0092"
revision = 'f6e7d2e01be1'
down_revision = 'd3d92b2d0092'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"notes_formsemestre_etapes",
"etape_apo",
op.alter_column('notes_formsemestre_etapes', 'etape_apo',
existing_type=sa.VARCHAR(length=16),
type_=sa.String(length=24),
existing_nullable=True,
)
op.alter_column(
"notes_formsemestre_inscription",
"etape",
existing_nullable=True)
op.alter_column('notes_formsemestre_inscription', 'etape',
existing_type=sa.VARCHAR(length=16),
type_=sa.String(length=24),
existing_nullable=True,
)
op.alter_column(
"notes_modules",
"code_apogee",
existing_nullable=True)
op.alter_column('notes_modules', 'code_apogee',
existing_type=sa.VARCHAR(length=16),
type_=sa.String(length=24),
existing_nullable=True,
)
op.alter_column(
"notes_ue",
"code_apogee",
existing_nullable=True)
op.alter_column('notes_ue', 'code_apogee',
existing_type=sa.VARCHAR(length=16),
type_=sa.String(length=24),
existing_nullable=True,
)
existing_nullable=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"notes_ue",
"code_apogee",
op.alter_column('notes_ue', 'code_apogee',
existing_type=sa.String(length=24),
type_=sa.VARCHAR(length=16),
existing_nullable=True,
)
op.alter_column(
"notes_modules",
"code_apogee",
existing_nullable=True)
op.alter_column('notes_modules', 'code_apogee',
existing_type=sa.String(length=24),
type_=sa.VARCHAR(length=16),
existing_nullable=True,
)
op.alter_column(
"notes_formsemestre_inscription",
"etape",
existing_nullable=True)
op.alter_column('notes_formsemestre_inscription', 'etape',
existing_type=sa.String(length=24),
type_=sa.VARCHAR(length=16),
existing_nullable=True,
)
op.alter_column(
"notes_formsemestre_etapes",
"etape_apo",
existing_nullable=True)
op.alter_column('notes_formsemestre_etapes', 'etape_apo',
existing_type=sa.String(length=24),
type_=sa.VARCHAR(length=16),
existing_nullable=True,
)
existing_nullable=True)
# ### end Alembic commands ###

View File

@ -10,29 +10,26 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f73251d1d825"
down_revision = "f6e7d2e01be1"
revision = 'f73251d1d825'
down_revision = 'f6e7d2e01be1'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"scodoc_site_config",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=128), nullable=False),
sa.Column("value", sa.Text(), nullable=True),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_scodoc_site_config_name"), "scodoc_site_config", ["name"], unique=False
op.create_table('scodoc_site_config',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=128), nullable=False),
sa.Column('value', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_scodoc_site_config_name'), 'scodoc_site_config', ['name'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_scodoc_site_config_name"), table_name="scodoc_site_config")
op.drop_table("scodoc_site_config")
op.drop_index(op.f('ix_scodoc_site_config_name'), table_name='scodoc_site_config')
op.drop_table('scodoc_site_config')
# ### end Alembic commands ###

View File

@ -10,31 +10,21 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f86c013c9fbd"
down_revision = "669065fb2d20"
revision = 'f86c013c9fbd'
down_revision = '669065fb2d20'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"notes_formations_acronyme_titre_version_key",
"notes_formations",
type_="unique",
)
op.create_unique_constraint(
None, "notes_formations", ["dept_id", "acronyme", "titre", "version"]
)
op.drop_constraint('notes_formations_acronyme_titre_version_key', 'notes_formations', type_='unique')
op.create_unique_constraint(None, 'notes_formations', ['dept_id', 'acronyme', 'titre', 'version'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "notes_formations", type_="unique")
op.create_unique_constraint(
"notes_formations_acronyme_titre_version_key",
"notes_formations",
["acronyme", "titre", "version"],
)
op.drop_constraint(None, 'notes_formations', type_='unique')
op.create_unique_constraint('notes_formations_acronyme_titre_version_key', 'notes_formations', ['acronyme', 'titre', 'version'])
# ### end Alembic commands ###

View File

@ -7,83 +7,64 @@ Source: http://wikipython.flibuste.net/moin.py/JouerAvecUnicode#head-1213938516c
"""
_reptable = {}
def _fill_reptable():
_corresp = [
("A", [0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x0100, 0x0102, 0x0104]),
("AE", [0x00C6]),
("a", [0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x0101, 0x0103, 0x0105]),
("ae", [0x00E6]),
("C", [0x00C7, 0x0106, 0x0108, 0x010A, 0x010C]),
("c", [0x00E7, 0x0107, 0x0109, 0x010B, 0x010D]),
("D", [0x00D0, 0x010E, 0x0110]),
("d", [0x00F0, 0x010F, 0x0111]),
("E", [0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0112, 0x0114, 0x0116, 0x0118, 0x011A]),
("e", [0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0113, 0x0115, 0x0117, 0x0119, 0x011B]),
("G", [0x011C, 0x011E, 0x0120, 0x0122]),
("g", [0x011D, 0x011F, 0x0121, 0x0123]),
("H", [0x0124, 0x0126]),
("h", [0x0125, 0x0127]),
("I", [0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0128, 0x012A, 0x012C, 0x012E, 0x0130]),
("i", [0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x0129, 0x012B, 0x012D, 0x012F, 0x0131]),
("IJ", [0x0132]),
("ij", [0x0133]),
("J", [0x0134]),
("j", [0x0135]),
("K", [0x0136]),
("k", [0x0137, 0x0138]),
("L", [0x0139, 0x013B, 0x013D, 0x013F, 0x0141]),
("l", [0x013A, 0x013C, 0x013E, 0x0140, 0x0142]),
("N", [0x00D1, 0x0143, 0x0145, 0x0147, 0x014A]),
("n", [0x00F1, 0x0144, 0x0146, 0x0148, 0x0149, 0x014B]),
("O", [0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D8, 0x014C, 0x014E, 0x0150]),
("o", [0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F8, 0x014D, 0x014F, 0x0151]),
("OE", [0x0152]),
("oe", [0x0153]),
("R", [0x0154, 0x0156, 0x0158]),
("r", [0x0155, 0x0157, 0x0159]),
("S", [0x015A, 0x015C, 0x015E, 0x0160]),
("s", [0x015B, 0x015D, 0x015F, 0x01610, 0x017F]),
("T", [0x0162, 0x0164, 0x0166]),
("t", [0x0163, 0x0165, 0x0167]),
(
"U",
[
0x00D9,
0x00DA,
0x00DB,
0x00DC,
0x0168,
0x016A,
0x016C,
0x016E,
0x0170,
0x172,
],
),
("u", [0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x016D, 0x016F, 0x0171]),
("W", [0x0174]),
("w", [0x0175]),
("Y", [0x00DD, 0x0176, 0x0178]),
("y", [0x00FD, 0x00FF, 0x0177]),
("Z", [0x0179, 0x017B, 0x017D]),
("z", [0x017A, 0x017C, 0x017E]),
("2", [0x00B2]), # deux exposant
(" ", [0x00A0]), # &nbsp
("", [0xB0]), # degre
("", [0xA9]), # copyright
("1/2", [0xBD]), # 1/2
(u"A", [0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x0100,0x0102,0x0104]),
(u"AE", [0x00C6]),
(u"a", [0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x0101,0x0103,0x0105]),
(u"ae", [0x00E6]),
(u"C", [0x00C7,0x0106,0x0108,0x010A,0x010C]),
(u"c", [0x00E7,0x0107,0x0109,0x010B,0x010D]),
(u"D", [0x00D0,0x010E,0x0110]),
(u"d", [0x00F0,0x010F,0x0111]),
(u"E", [0x00C8,0x00C9,0x00CA,0x00CB,0x0112,0x0114,0x0116,0x0118,0x011A]),
(u"e", [0x00E8,0x00E9,0x00EA,0x00EB,0x0113,0x0115,0x0117,0x0119,0x011B]),
(u"G", [0x011C,0x011E,0x0120,0x0122]),
(u"g", [0x011D,0x011F,0x0121,0x0123]),
(u"H", [0x0124,0x0126]),
(u"h", [0x0125,0x0127]),
(u"I", [0x00CC,0x00CD,0x00CE,0x00CF,0x0128,0x012A,0x012C,0x012E,0x0130]),
(u"i", [0x00EC,0x00ED,0x00EE,0x00EF,0x0129,0x012B,0x012D,0x012F,0x0131]),
(u"IJ", [0x0132]),
(u"ij", [0x0133]),
(u"J", [0x0134]),
(u"j", [0x0135]),
(u"K", [0x0136]),
(u"k", [0x0137,0x0138]),
(u"L", [0x0139,0x013B,0x013D,0x013F,0x0141]),
(u"l", [0x013A,0x013C,0x013E,0x0140,0x0142]),
(u"N", [0x00D1,0x0143,0x0145,0x0147,0x014A]),
(u"n", [0x00F1,0x0144,0x0146,0x0148,0x0149,0x014B]),
(u"O", [0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D8,0x014C,0x014E,0x0150]),
(u"o", [0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F8,0x014D,0x014F,0x0151]),
(u"OE", [0x0152]),
(u"oe", [0x0153]),
(u"R", [0x0154,0x0156,0x0158]),
(u"r", [0x0155,0x0157,0x0159]),
(u"S", [0x015A,0x015C,0x015E,0x0160]),
(u"s", [0x015B,0x015D,0x015F,0x01610,0x017F]),
(u"T", [0x0162,0x0164,0x0166]),
(u"t", [0x0163,0x0165,0x0167]),
(u"U", [0x00D9,0x00DA,0x00DB,0x00DC,0x0168,0x016A,0x016C,0x016E,0x0170,0x172]),
(u"u", [0x00F9,0x00FA,0x00FB,0x00FC,0x0169,0x016B,0x016D,0x016F,0x0171]),
(u"W", [0x0174]),
(u"w", [0x0175]),
(u"Y", [0x00DD,0x0176,0x0178]),
(u"y", [0x00FD,0x00FF,0x0177]),
(u"Z", [0x0179,0x017B,0x017D]),
(u"z", [0x017A,0x017C,0x017E]),
(u"2", [0x00B2]), # deux exposant
(u" ", [0x00A0]), # &nbsp
(u"", [0xB0]), # degre
(u"", [0xA9]), # copyright
(u"1/2", [0xBD]), # 1/2
]
global _reptable
for repchar,codes in _corresp :
for code in codes :
_reptable[code] = repchar
_fill_reptable()
def suppression_diacritics(s) :
"""Suppression des accents et autres marques.

0
pylintrc Executable file → Normal file
View File

0
sco_version.py Executable file → Normal file
View File

View File

@ -178,7 +178,7 @@ def test_abs_groupe_etat(api_headers):
# XXX TODO
# def reset_etud_abs(api_headers):
# """
# Test 'abs_groupe_etat'
# Test 'reset_etud_abs'
#
# Routes :
# - /absences/etudid/<int:etudid>/list_abs/<string:list_abs>/reset_etud_abs

View File

@ -70,7 +70,7 @@ def test_evaluations(api_headers):
assert eval["moduleimpl_id"] == moduleimpl_id
def test_evaluation_notes(api_headers):
def test_evaluation_notes(api_headers): # XXX TODO changer la boucle pour parcourir le dict sans les indices
"""
Test 'evaluation_notes'