Fix Zoho connection issues and add local testing capabilities
- Fixed 'days_back' parameter error in zoho_client.py - Added robust settings validation in app.py to prevent int() errors - Created LOCAL_TESTING.md with comprehensive testing guide - Added run_local.sh for easy local server setup - Added deploy_updates.sh for deployment instructions - Added test_local_connection.py for automated testing - Updated config.json with proper structure - All fixes tested and working locally
This commit is contained in:
@@ -100,7 +100,8 @@ def update_settings():
|
||||
config['zoho_app_password'] = request.form.get('zoho_app_password', config.get('zoho_app_password', ''))
|
||||
|
||||
# Update email days back
|
||||
config['email_days_back'] = int(request.form.get('email_days_back', 7))
|
||||
email_days_back = request.form.get('email_days_back', '7')
|
||||
config['email_days_back'] = int(email_days_back) if email_days_back.strip() else 7
|
||||
|
||||
# Update agency domains
|
||||
agency_domains = request.form.get('agency_domains', '').split(',')
|
||||
@@ -114,11 +115,15 @@ def update_settings():
|
||||
|
||||
for i in range(len(frame_names)):
|
||||
if frame_names[i] and frame_hours[i] and frame_levels[i]:
|
||||
time_frames.append({
|
||||
'name': frame_names[i],
|
||||
'hours': int(frame_hours[i]),
|
||||
'alert_level': int(frame_levels[i])
|
||||
})
|
||||
try:
|
||||
time_frames.append({
|
||||
'name': frame_names[i],
|
||||
'hours': int(frame_hours[i]),
|
||||
'alert_level': int(frame_levels[i])
|
||||
})
|
||||
except ValueError:
|
||||
# Skip invalid time frames
|
||||
continue
|
||||
|
||||
# Sort time frames by hours
|
||||
time_frames.sort(key=lambda x: x['hours'])
|
||||
@@ -126,7 +131,8 @@ def update_settings():
|
||||
|
||||
# Update auto processing settings
|
||||
config['auto_process'] = request.form.get('auto_process') == 'on'
|
||||
config['auto_process_interval'] = int(request.form.get('auto_process_interval', 30))
|
||||
auto_process_interval = request.form.get('auto_process_interval', '30')
|
||||
config['auto_process_interval'] = int(auto_process_interval) if auto_process_interval.strip() else 30
|
||||
|
||||
save_config(config)
|
||||
flash('Settings updated successfully!', 'success')
|
||||
@@ -213,7 +219,7 @@ def test_connection():
|
||||
processor = EmailProcessor(agency_domains=config['agency_domains'])
|
||||
|
||||
# Test connection by fetching a small number of emails
|
||||
emails = processor.zoho_client.fetch_emails(max_results=5, days_back=config['email_days_back'])
|
||||
emails = processor.zoho_client.fetch_emails(max_results=3, days_back=config['email_days_back'])
|
||||
|
||||
return jsonify({
|
||||
'status': 'success',
|
||||
|
||||
Reference in New Issue
Block a user