File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ class Config:
1818 "WORKSPACE" ,
1919 )
2020 OPTIONAL_ENVIRONMENT_VARIABLES : Iterable [str ] = ("ARTICLES_PUBLISH_DAYS_PAST" ,)
21- ARTICLES_PUBLISH_DAYS_PAST : str
21+
22+ ARTICLES_PUBLISH_DAYS_PAST : str | None = None
2223 FEED_TYPE : str
2324 CONNECTION_STRING : str
2425 SYMPLECTIC_FTP_USER : str
Original file line number Diff line number Diff line change 1- import os
21from abc import ABC , abstractmethod
32from collections .abc import Generator
43from contextlib import closing
1716 get_initials ,
1817)
1918
20- config = Config ()
21-
2219
2320class BaseXmlFeed (ABC ):
2421 """Base XML feed class.
@@ -121,6 +118,8 @@ def query(self) -> Select: # type: ignore[override]
121118 be in the future, so an article may be included multiple times in the XML output
122119 until its future date has passed.
123120 """
121+ config = Config ()
122+
124123 query_object = (
125124 select (aa_articles )
126125 .where (aa_articles .c .ARTICLE_ID .is_not (None ))
@@ -129,11 +128,11 @@ def query(self) -> Select: # type: ignore[override]
129128 .where (aa_articles .c .MIT_ID .is_not (None ))
130129 )
131130
132- if days_past := os . environ . get ( " ARTICLES_PUBLISH_DAYS_PAST" ) :
131+ if config . ARTICLES_PUBLISH_DAYS_PAST :
133132 query_object = query_object .where (
134133 text (
135134 "TO_DATE(PUBLISH_DATE, 'MM/DD/YYYY') >= "
136- f"SYSDATE - { int (days_past )} "
135+ f"SYSDATE - { int (config . ARTICLES_PUBLISH_DAYS_PAST )} "
137136 )
138137 )
139138
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def _test_env(ftp_server, monkeypatch):
4141 '"SYMPLECTIC_FTP_PASS": "pass"}'
4242 ),
4343 )
44- monkeypatch .delenv ("ARTICLES_PUBLISH_DAYS_PAST" )
44+ monkeypatch .delenv ("ARTICLES_PUBLISH_DAYS_PAST" , raising = False )
4545
4646
4747@pytest .fixture (autouse = True )
You can’t perform that action at this time.
0 commit comments