@@ -149,7 +149,8 @@ def configure_enforcer_auto_save_and_load(cls):
149149 Returns:
150150 None
151151 """
152- auto_load_policy_interval = getattr (settings , "CASBIN_AUTO_LOAD_POLICY_INTERVAL" , 0 )
152+ # auto_load_policy_interval = getattr(
153+ # settings, "CASBIN_AUTO_LOAD_POLICY_INTERVAL", 0)
153154 auto_save_policy = getattr (settings , "CASBIN_AUTO_SAVE_POLICY" , True )
154155
155156 # TODO: remove autoload in favor of cache invalidation?
@@ -178,7 +179,8 @@ def load_policy_if_needed(cls):
178179 if last_modified_timestamp is None :
179180 # No timestamp in cache; initialize it
180181 cache .set (cls .CACHE_KEY , current_timestamp , None )
181- logger .info (f">>>> Initialized policy last modified timestamp in cache. { current_timestamp } " )
182+ logger .info (
183+ f">>>> Initialized policy last modified timestamp in cache. { current_timestamp } " )
182184
183185 if (
184186 cls ._last_policy_load_timestamp is None or
@@ -261,11 +263,13 @@ def _initialize_enforcer(cls) -> SyncedEnforcer:
261263 # issues when the app is not fully loaded (e.g., while pulling translations, etc.).
262264 initialize_enforcer (db_alias )
263265 except Exception as e :
264- logger .error (f"Failed to initialize Casbin enforcer with DB alias '{ db_alias } ': { e } " )
266+ logger .error (
267+ f"Failed to initialize Casbin enforcer with DB alias '{ db_alias } ': { e } " )
265268 raise
266269
267270 adapter = ExtendedAdapter ()
268271 enforcer = SyncedEnforcer (settings .CASBIN_MODEL , adapter )
269- enforcer .add_function ("is_staff_or_superuser" , is_admin_or_superuser_check )
272+ enforcer .add_function ("is_staff_or_superuser" ,
273+ is_admin_or_superuser_check )
270274
271275 return enforcer
0 commit comments