diff --git a/files/classes/user.py b/files/classes/user.py index b9da63782a..952caae8f2 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -45,7 +45,7 @@ else: DEFAULT_COINS = 0 DEFAULT_MARSEYBUX = 0 -if IS_FISTMAS(): +if IS_FISTMAS: if SITE_NAME == 'rDrama': default_event_music = True default_darkmode = False @@ -161,7 +161,7 @@ class User(Base): spider = Column(Integer, default=0) blacklisted_by = Column(Integer, ForeignKey("users.id")) - if IS_FISTMAS(): + if IS_FISTMAS: event_music = Column(Boolean, default=default_event_music, nullable=False) event_darkmode = Column(Boolean, default=default_darkmode, nullable=False) @@ -300,7 +300,7 @@ class User(Base): @lazy def hat_active(self, v): if FEATURES['HATS']: - if IS_FISTMAS(): + if IS_FISTMAS: hat = random.choice(('Santa Hat III', 'Winter Cap', 'Present Bow')) if SITE_NAME == 'rDrama': return (f'/i/hats/{hat}.webp', 'Merry Fistmas!') @@ -1198,7 +1198,7 @@ class User(Base): return output - if IS_FISTMAS(): + if IS_FISTMAS: @property @lazy def can_toggle_event_music(self): diff --git a/files/helpers/actions.py b/files/helpers/actions.py index 5c54435712..6097e0abaa 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -60,7 +60,7 @@ def execute_snappy(post:Submission, v:User): body = "Can you people come up with any ideas that don't involve committing federal crimes" else: if SNAPPY_MARSEYS and SNAPPY_QUOTES: - if IS_FISTMAS() or random.random() > 0.5: + if IS_FISTMAS or random.random() > 0.5: SNAPPY_CHOICES = SNAPPY_QUOTES else: SNAPPY_CHOICES = SNAPPY_MARSEYS diff --git a/files/helpers/assetcache.py b/files/helpers/assetcache.py index 19a2ed8045..70394d203d 100644 --- a/files/helpers/assetcache.py +++ b/files/helpers/assetcache.py @@ -12,7 +12,7 @@ ASSET_SUBDIRS = ['/css', '/js', '/js/vendor'] ASSET_URL = '/assets/' ASSET_CACHE = defaultdict(lambda: None) -if IS_FISTMAS(): +if IS_FISTMAS: ASSET_SUBDIRS.extend(['/fistmas/css', '/fistmas/css/themes', '/fistmas/js', '/fistmas/js/vendor']) def assetcache_build(asset_dir, subdirs): diff --git a/files/helpers/config/awards.py b/files/helpers/config/awards.py index 98645d8e5d..a996254e69 100644 --- a/files/helpers/config/awards.py +++ b/files/helpers/config/awards.py @@ -53,7 +53,7 @@ AWARDS = { "deflectable": True, "cosmetic": False, "ghost": False, - "enabled": IS_FISTMAS(), + "enabled": IS_FISTMAS, }, "snow": { "kind": "snow", @@ -65,7 +65,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_FISTMAS(), + "enabled": IS_FISTMAS, }, "gingerbread": { "kind": "gingerbread", @@ -77,7 +77,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_FISTMAS(), + "enabled": IS_FISTMAS, }, "lights": { "kind": "lights", @@ -89,7 +89,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_FISTMAS(), + "enabled": IS_FISTMAS, }, "candycane": { "kind": "candycane", @@ -101,7 +101,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_FISTMAS(), + "enabled": IS_FISTMAS, }, "fireplace": { "kind": "fireplace", @@ -113,7 +113,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_FISTMAS(), + "enabled": IS_FISTMAS, }, "frostbite": { "kind": "frostbite", @@ -125,7 +125,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_FISTMAS(), + "enabled": IS_FISTMAS, }, "grinch": { "kind": "grinch", @@ -137,7 +137,7 @@ AWARDS = { "deflectable": True, "cosmetic": False, "ghost": False, - "enabled": IS_FISTMAS(), + "enabled": IS_FISTMAS, }, ### Homoween @@ -151,7 +151,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "upsidedown": { "kind": "upsidedown", @@ -163,7 +163,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "stab": { "kind": "stab", @@ -175,7 +175,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "spiders": { "kind": "spiders", @@ -187,7 +187,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "fog": { "kind": "fog", @@ -199,7 +199,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "jumpscare": { "kind": "jumpscare", @@ -211,7 +211,7 @@ AWARDS = { "deflectable": True, "cosmetic": False, "ghost": False, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "hw-bite": { "kind": "hw-bite", @@ -223,7 +223,7 @@ AWARDS = { "deflectable": True, "cosmetic": False, "ghost": False, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "hw-vax": { "kind": "hw-vax", @@ -235,7 +235,7 @@ AWARDS = { "deflectable": True, "cosmetic": False, "ghost": False, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "hw-grinch": { "kind": "hw-grinch", @@ -247,7 +247,7 @@ AWARDS = { "deflectable": True, "cosmetic": False, "ghost": False, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "flashlight": { "kind": "flashlight", @@ -259,7 +259,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "candy-corn": { "kind": "candy-corn", @@ -271,7 +271,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "ectoplasm": { "kind": "ectoplasm", @@ -283,7 +283,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "bones": { "kind": "bones", @@ -295,7 +295,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, "pumpkin": { "kind": "pumpkin", @@ -307,7 +307,7 @@ AWARDS = { "deflectable": False, "cosmetic": True, "ghost": True, - "enabled": IS_HOMOWEEN(), + "enabled": IS_HOMOWEEN, }, ### Standard diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index cf30fa1e5b..b7aafee550 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -8,13 +8,13 @@ t = datetime.datetime.now() fistmas_begin = datetime.datetime.strptime(f'1/12/{t.year}', '%d/%m/%Y') fistmas_end = datetime.datetime.strptime(f'30/12/{t.year}', '%d/%m/%Y') -def IS_FISTMAS(): - return fistmas_begin < datetime.datetime.now() < fistmas_end + +IS_FISTMAS = fistmas_begin < datetime.datetime.now() < fistmas_end homoween_begin = datetime.datetime.strptime(f'15/10/{t.year}', '%d/%m/%Y') homoween_end = datetime.datetime.strptime(f'1/11/{t.year}', '%d/%m/%Y') -def IS_HOMOWEEN(): - return homoween_begin < datetime.datetime.now() < homoween_end + +IS_HOMOWEEN = homoween_begin < datetime.datetime.now() < homoween_end DEFAULT_TIME_FILTER = "all" DEFAULT_THEME = "midnight" diff --git a/files/helpers/const_stateful.py b/files/helpers/const_stateful.py index 4b8a5f74e8..0ea456a973 100644 --- a/files/helpers/const_stateful.py +++ b/files/helpers/const_stateful.py @@ -32,7 +32,7 @@ def _initialize_snappy_marseys_and_quotes(): SNAPPY_MARSEYS = [f':#{x}:' for x in marseys_const2] filename = f"snappy_{SITE_NAME}.txt" - if IS_FISTMAS(): filename = f"snappy_event_{SITE_NAME}.txt" + if IS_FISTMAS: filename = f"snappy_event_{SITE_NAME}.txt" try: with open(filename, "r", encoding="utf-8") as f: diff --git a/files/routes/settings.py b/files/routes/settings.py index 3ad682708e..a3194b0328 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -201,7 +201,7 @@ def settings_personal_post(v): badge = v.has_badge(179) if badge: g.db.delete(badge) - elif IS_FISTMAS() and not updated and request.values.get("event_music", v.event_music) != v.event_music and v.can_toggle_event_music: + elif IS_FISTMAS and not updated and request.values.get("event_music", v.event_music) != v.event_music and v.can_toggle_event_music: updated = True v.event_music = not v.event_music @@ -920,7 +920,7 @@ def settings_checkmark_text(v): g.db.add(v) return redirect("/settings/personal?msg=Checkmark Text successfully updated!") -if IS_FISTMAS(): +if IS_FISTMAS: @app.post("/events/fistmas2022/darkmode") @limiter.limit('1/second', scope=rpath) @limiter.limit(DEFAULT_RATELIMIT) diff --git a/files/routes/votes.py b/files/routes/votes.py index 13cf730303..d410dbe8d8 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -89,7 +89,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls): if SITE_NAME == 'WPD': coin_mult *= 2 - if IS_FISTMAS(): + if IS_FISTMAS: coin_mult *= 2 coin_value = coin_delta * coin_mult diff --git a/files/templates/default.html b/files/templates/default.html index 4397606ec9..cb841501a3 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -4,7 +4,7 @@ {% block banner %} {% include "modals/expanded_image.html" %} {% if err or '@' not in request.path %} - {% if IS_FISTMAS() and not sub %} + {% if IS_FISTMAS and not sub %} {% include 'fistmas/banner.html' %} {% else %} {% if err and SITE_NAME == 'rDrama' %} @@ -79,7 +79,7 @@ {% endif %} -{% if IS_FISTMAS() %} +{% if IS_FISTMAS %} {% include "fistmas/music.html" %} {% endif %} diff --git a/files/templates/header.html b/files/templates/header.html index 15d40b8fb0..7ad6474f00 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -10,7 +10,7 @@ {% if range(1,5) | random == 1 %} {% include "journoid_banner.html" %} {% else %} - {% if IS_FISTMAS() %} + {% if IS_FISTMAS %} {%- set VISITORS_HERE_FLAVOR = [ ' santa enjoyers kissing under a misletoe', ' bringing up family drama at Christmas dinner', @@ -55,7 +55,7 @@ -{% if IS_FISTMAS() %} +{% if IS_FISTMAS %} {% endif %} diff --git a/files/templates/userpage/userpage.html b/files/templates/userpage/userpage.html index a686b3c50c..d6227c3000 100644 --- a/files/templates/userpage/userpage.html +++ b/files/templates/userpage/userpage.html @@ -28,7 +28,7 @@
{{u.username}}
{% endif %} -{% if not IS_FISTMAS() or SITE_NAME == 'WPD' %} +{% if not IS_FISTMAS or SITE_NAME == 'WPD' %} {% endif %} {% endblock %} diff --git a/files/templates/util/html_head.html b/files/templates/util/html_head.html index c98032827f..9a20e9a26b 100644 --- a/files/templates/util/html_head.html +++ b/files/templates/util/html_head.html @@ -99,7 +99,7 @@ {% if v.agendaposter %} {% endif %} - {% if include_user_css and not IS_FISTMAS() %} + {% if include_user_css and not IS_FISTMAS %} {% if v.theme == 'classic_dark' %} {% endif %} @@ -123,7 +123,7 @@ {% endif %} - {% if IS_FISTMAS() %} + {% if IS_FISTMAS %} {% if v and v.event_darkmode %}