Skip to content

Commit 1a0530c

Browse files
committed
mm_cfg possible breaking change test
1 parent d0d983e commit 1a0530c

1 file changed

Lines changed: 2 additions & 36 deletions

File tree

Mailman/Queue/IncomingRunner.py

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -143,47 +143,13 @@ def _get_pipeline(self, mlist, msg, msgdata):
143143
if pipeline is None:
144144
pipeline = getattr(mlist, 'pipeline', None)
145145
if pipeline is None:
146-
# Store the original mm_cfg reference to avoid circular imports
147-
original_mm_cfg = mm_cfg
148-
149-
syslog('debug', 'mm_cfg module file: %s', original_mm_cfg.__file__)
150-
syslog('debug', 'Loading GLOBAL_PIPELINE from mm_cfg: %s (type: %s)', original_mm_cfg.GLOBAL_PIPELINE, type(original_mm_cfg.GLOBAL_PIPELINE).__name__)
151-
syslog('debug', 'sys.path at pipeline load: %s', sys.path)
152-
syslog('debug', 'mm_cfg module loaded at: %s', original_mm_cfg.__cached__ if hasattr(original_mm_cfg, '__cached__') else 'No cache')
153-
syslog('debug', 'mm_cfg module name: %s', original_mm_cfg.__name__)
154-
syslog('debug', 'mm_cfg module spec: %s', original_mm_cfg.__spec__)
155-
syslog('debug', 'mm_cfg module id: %s', id(original_mm_cfg))
156-
syslog('debug', 'mm_cfg module dict: %s', list(original_mm_cfg.__dict__.keys())[:10])
157-
# Check if there's a site-specific override
158-
if hasattr(original_mm_cfg, '__file__'):
159-
mm_cfg_dir = os.path.dirname(original_mm_cfg.__file__)
160-
site_config = os.path.join(mm_cfg_dir, 'mm_cfg.py')
161-
if os.path.exists(site_config):
162-
syslog('debug', 'Site config exists: %s', site_config)
163-
164-
# Force reload mm_cfg if GLOBAL_PIPELINE is not available
165-
if not hasattr(original_mm_cfg, 'GLOBAL_PIPELINE'):
166-
syslog('debug', 'GLOBAL_PIPELINE not found, forcing reload of mm_cfg')
167-
import importlib
168-
importlib.reload(original_mm_cfg)
169-
syslog('debug', 'After reload - GLOBAL_PIPELINE: %s', getattr(original_mm_cfg, 'GLOBAL_PIPELINE', 'NOT FOUND'))
170-
171-
pipeline = original_mm_cfg.GLOBAL_PIPELINE
146+
# Use the already-imported mm_cfg directly
147+
pipeline = mm_cfg.GLOBAL_PIPELINE
172148

173149
# Ensure pipeline is a list that can be sliced
174150
if not isinstance(pipeline, list):
175-
import traceback
176-
# Use the original mm_cfg reference to avoid circular imports
177-
original_mm_cfg = mm_cfg
178151
syslog('error', 'GLOBAL_PIPELINE is not a list: %s (type: %s)',
179152
pipeline, type(pipeline).__name__)
180-
syslog('error', 'mm_cfg module file: %s', original_mm_cfg.__file__)
181-
syslog('error', 'sys.path: %s', sys.path)
182-
syslog('error', 'mm_cfg.__dict__ keys: %s', list(original_mm_cfg.__dict__.keys())[:10])
183-
syslog('error', 'mm_cfg module loaded at: %s', original_mm_cfg.__cached__ if hasattr(original_mm_cfg, '__cached__') else 'No cache')
184-
syslog('error', 'mm_cfg module name: %s', original_mm_cfg.__name__)
185-
syslog('error', 'mm_cfg module spec: %s', original_mm_cfg.__spec__)
186-
syslog('error', 'Traceback: %s', ''.join(traceback.format_stack()))
187153
# Fallback to a basic pipeline
188154
pipeline = ['SpamDetect', 'Approve', 'Moderate', 'Hold',
189155
'CalcRecips', 'CookHeaders', 'ToOutgoing']

0 commit comments

Comments
 (0)