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: if competence is not None:
query = query.filter(ApcNiveau.competence == competence) query = query.filter(ApcNiveau.competence == competence)
return query return query
<<<<<<< HEAD
def __init__(self, id, niveau_id, code, libelle, modules): def __init__(self, id, niveau_id, code, libelle, modules):
self.id = id self.id = id
@ -459,8 +458,6 @@ class ApcAppCritique(db.Model, XMLModel):
self.code = code self.code = code
self.libelle = libelle self.libelle = libelle
self.modules = modules self.modules = modules
=======
>>>>>>> 7c340c798ad59c41653efc83bfd079f11fce1938
def to_dict(self) -> dict: def to_dict(self) -> dict:
return {"libelle": self.libelle} return {"libelle": self.libelle}
@ -547,14 +544,11 @@ class ApcAnneeParcours(db.Model, XMLModel):
) )
ordre = db.Column(db.Integer) ordre = db.Column(db.Integer)
"numéro de l'année: 1, 2, 3" "numéro de l'année: 1, 2, 3"
<<<<<<< HEAD
def __init__(self, id, parcours_id, ordre): def __init__(self, id, parcours_id, ordre):
self.id = id self.id = id
self.parcours_id = parcours_id self.parcours_id = parcours_id
self.ordre = ordre self.ordre = ordre
=======
>>>>>>> 7c340c798ad59c41653efc83bfd079f11fce1938
def __repr__(self): def __repr__(self):
return f"<{self.__class__.__name__} {self.id} ordre={self.ordre!r} parcours={self.parcours.code!r}>" 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 :return: le résultat de la recherche ou None si aucune image trouvée
""" """
allowed_ext = "|".join(scu.LOGOS_IMAGES_ALLOWED_TYPES) 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 = {} logos = {}
path_dir = Path(scu.SCODOC_LOGOS_DIR) path_dir = Path(scu.SCODOC_LOGOS_DIR)
if dept_id: 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): if os.access(path_dir.joinpath(entry).absolute(), os.R_OK):
result = filename_parser.match(entry.name) result = filename_parser.match(entry.name)
if result: 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() logos[logoname] = Logo(logoname=logoname, dept_id=dept_id).select()
return logos if len(logos.keys()) > 0 else None 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" 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): def _set_format(self, fmt):
self.suffix = fmt self.suffix = fmt
self.filepath = self.basepath + "." + 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. # Interpret the config file for Python logging.
# This line sets up loggers basically. # This line sets up loggers basically.
fileConfig(config.config_file_name) fileConfig(config.config_file_name)
logger = logging.getLogger("alembic.env") logger = logging.getLogger('alembic.env')
# add your model's MetaData object here # add your model's MetaData object here
# for 'autogenerate' support # for 'autogenerate' support
# from myapp import mymodel # from myapp import mymodel
# target_metadata = mymodel.Base.metadata # target_metadata = mymodel.Base.metadata
config.set_main_option( config.set_main_option(
"sqlalchemy.url", 'sqlalchemy.url',
str(current_app.extensions["migrate"].db.get_engine().url).replace("%", "%%"), str(current_app.extensions['migrate'].db.get_engine().url).replace(
) '%', '%%'))
target_metadata = current_app.extensions["migrate"].db.metadata target_metadata = current_app.extensions['migrate'].db.metadata
# other values from the config, defined by the needs of env.py, # other values from the config, defined by the needs of env.py,
# can be acquired: # can be acquired:
@ -45,7 +45,9 @@ def run_migrations_offline():
""" """
url = config.get_main_option("sqlalchemy.url") 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(): with context.begin_transaction():
context.run_migrations() context.run_migrations()
@ -63,20 +65,20 @@ def run_migrations_online():
# when there are no changes to the schema # when there are no changes to the schema
# reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
def process_revision_directives(context, revision, directives): def process_revision_directives(context, revision, directives):
if getattr(config.cmd_opts, "autogenerate", False): if getattr(config.cmd_opts, 'autogenerate', False):
script = directives[0] script = directives[0]
if script.upgrade_ops.is_empty(): if script.upgrade_ops.is_empty():
directives[:] = [] 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: with connectable.connect() as connection:
context.configure( context.configure(
connection=connection, connection=connection,
target_metadata=target_metadata, target_metadata=target_metadata,
process_revision_directives=process_revision_directives, process_revision_directives=process_revision_directives,
**current_app.extensions["migrate"].configure_args **current_app.extensions['migrate'].configure_args
) )
with context.begin_transaction(): with context.begin_transaction():

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,77 +10,46 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = "92789d50f6b6" revision = '92789d50f6b6'
down_revision = "00ad500fb118" down_revision = '00ad500fb118'
branch_labels = None branch_labels = None
depends_on = None depends_on = None
def upgrade(): def upgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### commands auto generated by Alembic - please adjust! ###
op.drop_table("modules_acs") op.drop_table('modules_acs')
op.drop_table("app_crit") op.drop_table('app_crit')
op.add_column("apc_annee_parcours", sa.Column("ordre", sa.Integer(), nullable=True)) op.add_column('apc_annee_parcours', sa.Column('ordre', sa.Integer(), nullable=True))
op.drop_column("apc_annee_parcours", "numero") op.drop_column('apc_annee_parcours', 'numero')
op.create_index( op.create_index(op.f('ix_apc_app_critique_code'), 'apc_app_critique', ['code'], unique=False)
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.create_unique_constraint( op.add_column('apc_referentiel_competences', sa.Column('scodoc_date_loaded', sa.DateTime(), nullable=True))
"apc_competence_referentiel_id_titre_key", op.add_column('apc_referentiel_competences', sa.Column('scodoc_orig_filename', sa.Text(), nullable=True))
"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 ### # ### end Alembic commands ###
def downgrade(): def downgrade():
# ### commands auto generated by Alembic - please adjust! ### # ### commands auto generated by Alembic - please adjust! ###
op.drop_column("apc_referentiel_competences", "scodoc_orig_filename") op.drop_column('apc_referentiel_competences', 'scodoc_orig_filename')
op.drop_column("apc_referentiel_competences", "scodoc_date_loaded") op.drop_column('apc_referentiel_competences', 'scodoc_date_loaded')
op.drop_index(op.f("ix_apc_competence_titre"), table_name="apc_competence") op.drop_index(op.f('ix_apc_competence_titre'), table_name='apc_competence')
op.drop_constraint( op.drop_constraint('apc_competence_referentiel_id_titre_key', 'apc_competence', type_='unique')
"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.create_table('modules_acs',
op.add_column( sa.Column('module_id', sa.INTEGER(), autoincrement=False, nullable=True),
"apc_annee_parcours", sa.Column('ac_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column("numero", 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.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"
),
) )
# ### end Alembic commands ### # ### end Alembic commands ###

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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 # XXX TODO
# def reset_etud_abs(api_headers): # def reset_etud_abs(api_headers):
# """ # """
# Test 'abs_groupe_etat' # Test 'reset_etud_abs'
# #
# Routes : # Routes :
# - /absences/etudid/<int:etudid>/list_abs/<string:list_abs>/reset_etud_abs # - /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 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' Test 'evaluation_notes'