Skip to content

Commit 7f732cf

Browse files
BENETEAU ClaireBENETEAU Claire
authored andcommitted
signale_source_code_V1.5.1
1 parent 5d9afa2 commit 7f732cf

File tree

428 files changed

+45737
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

428 files changed

+45737
-0
lines changed

zam-repondeur-1.5.1/MANIFEST.in

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Manifest syntax https://docs.python.org/2/distutils/sourcedist.html
2+
graft wheelhouse
3+
4+
recursive-exclude __pycache__ *.pyc *.pyo *.orig
5+
6+
exclude *.js*
7+
exclude *.git*
8+
exclude *.coveragerc
9+
exclude *.sh
10+
exclude proc*
11+
exclude pylint*
12+
exclude README*
13+
14+
recursive-include zam_repondeur/templates *.*
15+
recursive-include zam_repondeur/static *.*
16+
recursive-include db_migrations *.*
17+
include deploy_requirements.txt
18+
exclude requirements*.*
19+
include *.py
20+
21+
prune .git
22+
prune venv
23+
prune test*

zam-repondeur-1.5.1/PKG-INFO

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Metadata-Version: 1.0
2+
Name: zam-repondeur
3+
Version: 1.5.1
4+
Summary: UNKNOWN
5+
Home-page: UNKNOWN
6+
Author: UNKNOWN
7+
Author-email: UNKNOWN
8+
License: UNKNOWN
9+
Description-Content-Type: UNKNOWN
10+
Description: UNKNOWN
11+
Platform: UNKNOWN
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
from logging.config import fileConfig
2+
3+
from alembic import context
4+
from sqlalchemy import engine_from_config, pool
5+
6+
from zam_repondeur.models import Base
7+
8+
# this is the Alembic Config object, which provides
9+
# access to the values within the .ini file in use.
10+
config = context.config
11+
12+
# Interpret the config file for Python logging.
13+
# This line sets up loggers basically.
14+
fileConfig(config.config_file_name)
15+
16+
# add your model's MetaData object here
17+
# for 'autogenerate' support
18+
target_metadata = Base.metadata
19+
20+
# other values from the config, defined by the needs of env.py,
21+
# can be acquired:
22+
# my_important_option = config.get_main_option("my_important_option")
23+
# ... etc.
24+
25+
26+
def run_migrations_offline():
27+
"""Run migrations in 'offline' mode.
28+
29+
This configures the context with just a URL
30+
and not an Engine, though an Engine is acceptable
31+
here as well. By skipping the Engine creation
32+
we don't even need a DBAPI to be available.
33+
34+
Calls to context.execute() here emit the given string to the
35+
script output.
36+
37+
"""
38+
url = config.get_main_option("sqlalchemy.url")
39+
40+
# We need to use batch mode to alter tables in SQLite
41+
# see: http://alembic.zzzcomputing.com/en/latest/batch.html
42+
context.configure(
43+
url=url,
44+
target_metadata=target_metadata,
45+
literal_binds=True,
46+
render_as_batch=True,
47+
)
48+
49+
with context.begin_transaction():
50+
context.run_migrations()
51+
52+
53+
def run_migrations_online():
54+
"""Run migrations in 'online' mode.
55+
56+
In this scenario we need to create an Engine
57+
and associate a connection with the context.
58+
59+
"""
60+
connectable = engine_from_config(
61+
config.get_section(config.config_ini_section),
62+
prefix="sqlalchemy.",
63+
poolclass=pool.NullPool,
64+
)
65+
66+
with connectable.connect() as connection:
67+
context.configure(connection=connection, target_metadata=target_metadata)
68+
69+
with context.begin_transaction():
70+
context.run_migrations()
71+
72+
73+
if context.is_offline_mode():
74+
run_migrations_offline()
75+
else:
76+
run_migrations_online()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""${message}
2+
3+
Revision ID: ${up_revision}
4+
Revises: ${down_revision | comma,n}
5+
Create Date: ${create_date}
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
${imports if imports else ""}
11+
12+
# revision identifiers, used by Alembic.
13+
revision = ${repr(up_revision)}
14+
down_revision = ${repr(down_revision)}
15+
branch_labels = ${repr(branch_labels)}
16+
depends_on = ${repr(depends_on)}
17+
18+
19+
def upgrade():
20+
${upgrades if upgrades else "pass"}
21+
22+
23+
def downgrade():
24+
${downgrades if downgrades else "pass"}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""Move observations to reponse for government amendements
2+
3+
Revision ID: 068feac86821
4+
Revises: 15301bb743b1
5+
Create Date: 2018-11-05 14:29:44.080790
6+
7+
"""
8+
from alembic import op
9+
10+
# revision identifiers, used by Alembic.
11+
revision = "068feac86821"
12+
down_revision = "15301bb743b1"
13+
branch_labels = None
14+
depends_on = None
15+
16+
17+
def upgrade():
18+
op.execute(
19+
"""
20+
UPDATE amendements
21+
SET reponse = observations, observations = ''
22+
WHERE auteur = 'LE GOUVERNEMENT';
23+
"""
24+
)
25+
26+
27+
def downgrade():
28+
op.execute(
29+
"""
30+
UPDATE amendements
31+
SET observations = reponse, reponse = ''
32+
WHERE auteur = 'LE GOUVERNEMENT';
33+
"""
34+
)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""Add users and teams
2+
3+
Revision ID: 06e826937905
4+
Revises: ccc17664477b
5+
Create Date: 2019-01-09 09:08:02.482576
6+
7+
"""
8+
import sqlalchemy as sa
9+
from alembic import op
10+
11+
# revision identifiers, used by Alembic.
12+
revision = "06e826937905"
13+
down_revision = "ccc17664477b"
14+
branch_labels = None
15+
depends_on = None
16+
17+
18+
def upgrade():
19+
op.create_table(
20+
"teams",
21+
sa.Column("pk", sa.Integer(), nullable=False),
22+
sa.Column("name", sa.Text(), nullable=False),
23+
sa.Column(
24+
"created_at", sa.DateTime(), server_default=sa.text("now()"), nullable=False
25+
),
26+
sa.PrimaryKeyConstraint("pk"),
27+
)
28+
op.create_table(
29+
"users",
30+
sa.Column("pk", sa.Integer(), nullable=False),
31+
sa.Column("email", sa.String(length=255), nullable=False),
32+
sa.Column("name", sa.Text(), nullable=True),
33+
sa.Column(
34+
"created_at", sa.DateTime(), server_default=sa.text("now()"), nullable=False
35+
),
36+
sa.Column("last_login_at", sa.DateTime(), nullable=True),
37+
sa.PrimaryKeyConstraint("pk"),
38+
)
39+
op.create_table(
40+
"teams2users",
41+
sa.Column("team_pk", sa.Integer(), nullable=False),
42+
sa.Column("user_pk", sa.Integer(), nullable=False),
43+
sa.ForeignKeyConstraint(["team_pk"], ["teams.pk"]),
44+
sa.ForeignKeyConstraint(["user_pk"], ["users.pk"]),
45+
sa.PrimaryKeyConstraint("team_pk", "user_pk"),
46+
)
47+
48+
49+
def downgrade():
50+
op.drop_table("teams2users")
51+
op.drop_table("users")
52+
op.drop_table("teams")
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Add teams back
2+
3+
Revision ID: 0a44e476eabc
4+
Revises: d3b8033f60c4
5+
Create Date: 2019-02-26 19:08:58.929724
6+
7+
"""
8+
import sqlalchemy as sa
9+
from alembic import op
10+
11+
# revision identifiers, used by Alembic.
12+
revision = "0a44e476eabc"
13+
down_revision = "d3b8033f60c4"
14+
branch_labels = None
15+
depends_on = None
16+
17+
18+
def upgrade():
19+
op.create_table(
20+
"teams",
21+
sa.Column("pk", sa.Integer(), nullable=False),
22+
sa.Column("name", sa.Text(), nullable=False),
23+
sa.Column(
24+
"created_at", sa.DateTime(), server_default=sa.text("now()"), nullable=False
25+
),
26+
sa.PrimaryKeyConstraint("pk"),
27+
)
28+
op.create_table(
29+
"teams2users",
30+
sa.Column("team_pk", sa.Integer(), nullable=False),
31+
sa.Column("user_pk", sa.Integer(), nullable=False),
32+
sa.ForeignKeyConstraint(["team_pk"], ["teams.pk"]),
33+
sa.ForeignKeyConstraint(["user_pk"], ["users.pk"]),
34+
sa.PrimaryKeyConstraint("team_pk", "user_pk"),
35+
)
36+
37+
38+
def downgrade():
39+
op.drop_table("teams2users")
40+
op.drop_table("teams")
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""Refactor the lecture journal to use events (like articles and amendements)
2+
3+
Revision ID: 1162a0c4fc23
4+
Revises: a90e77416ebe
5+
Create Date: 2019-01-28 14:55:41.056170
6+
7+
"""
8+
import sqlalchemy as sa
9+
from alembic import op
10+
from sqlalchemy.dialects import postgresql
11+
12+
# revision identifiers, used by Alembic.
13+
revision = "1162a0c4fc23"
14+
down_revision = "a90e77416ebe"
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
op.drop_table("journal")
21+
op.add_column("events", sa.Column("lecture_pk", sa.Integer(), nullable=True))
22+
op.create_foreign_key(
23+
"events_lecture_pk_fkey", "events", "lectures", ["lecture_pk"], ["pk"]
24+
)
25+
26+
27+
def downgrade():
28+
op.drop_constraint("events_lecture_pk_fkey", "events", type_="foreignkey")
29+
op.drop_column("events", "lecture_pk")
30+
op.create_table(
31+
"journal",
32+
sa.Column("pk", sa.INTEGER(), autoincrement=True, nullable=False),
33+
sa.Column("kind", sa.TEXT(), autoincrement=False, nullable=True),
34+
sa.Column("message", sa.TEXT(), autoincrement=False, nullable=True),
35+
sa.Column(
36+
"created_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
37+
),
38+
sa.Column("lecture_pk", sa.INTEGER(), autoincrement=False, nullable=True),
39+
sa.ForeignKeyConstraint(
40+
["lecture_pk"], ["lectures.pk"], name="journal_lecture_pk_fkey"
41+
),
42+
sa.PrimaryKeyConstraint("pk", name="journal_pkey"),
43+
)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""Split Article model
2+
3+
Revision ID: 12f50566c917
4+
Revises: cbb2e504c783
5+
Create Date: 2018-12-10 11:31:28.275275
6+
7+
"""
8+
import sqlalchemy as sa
9+
from alembic import op
10+
11+
# revision identifiers, used by Alembic.
12+
revision = "12f50566c917"
13+
down_revision = "cbb2e504c783"
14+
branch_labels = None
15+
depends_on = None
16+
17+
18+
def upgrade():
19+
article_user_contents = op.create_table(
20+
"article_user_contents",
21+
sa.Column("pk", sa.Integer(), nullable=False),
22+
sa.Column("title", sa.Text(), nullable=True),
23+
sa.Column("presentation", sa.Text(), nullable=True),
24+
sa.Column("article_pk", sa.Integer(), nullable=True),
25+
sa.ForeignKeyConstraint(["article_pk"], ["articles.pk"]),
26+
sa.PrimaryKeyConstraint("pk"),
27+
)
28+
connection = op.get_bind()
29+
results = connection.execute("SELECT pk, titre, jaune FROM articles;")
30+
op.bulk_insert(
31+
article_user_contents,
32+
[
33+
{"article_pk": pk, "title": titre, "presentation": jaune}
34+
for pk, titre, jaune in results
35+
],
36+
)
37+
op.drop_column("articles", "titre")
38+
op.drop_column("articles", "jaune")
39+
40+
41+
def downgrade():
42+
raise NotImplementedError

0 commit comments

Comments
 (0)