Why is Python concatenating strings in a list rather than iterating over them?

In a CGI Python script, I have lists of strings that are keys to a hash:

APPENDIX_WEBSITES = ['CJSHayward']
MAIN_WEBSITES = ['Alfresco',
  'Bible',
  'Fathers',
  'MyCollab',
  'Koha',
  'MediaWiki',
  'Moodle',
  'RequestTracker',
  'SuiteCRM',
  'TikiWiki',
  'Wordpress']
# The variable "data" is populated with a hash containing all above entries as keys.
sys.stderr.write(repr(MAIN_WEBSITES) + '\n')
sys.stderr.write(repr(APPENDIX_WEBSITES) + '\n')
sys.stderr.write(repr(MAIN_WEBSITES + APPENDIX_WEBSITES) + '\n')
for website in MAIN_WEBSITES + APPENDIX_WEBSITES:
    sys.stderr.write(website)

      

The Apache log says:

[Tue Aug 08 16: 25: 34.266769 2017] [cgi: error] [pid 16429] [client 127.0.0.1:40600] AH01215: ['Alfresco', 'Bible', 'Fathers', 'MyCollab', 'Koha' , 'MediaWiki', 'Moodle', 'RequestTracker', 'SuiteCRM', 'TikiWiki', 'Wordpress']: /usr/local/websites/home/www/configure/index.cgi, referer: http: // localhost /
[Tue Aug 08 16: 25: 34.267050 2017] [cgi: error] [pid 16429] [client 127.0.0.1:40600] AH01215: ['CJSHayward']: / usr / local / websites / home / www / configure / index .cgi, referer: http: // localhost /
[Tue Aug 08 16: 25: 34.267268 2017] [cgi: error] [pid 16429] [client 127.0.0.1:40600] AH01215: ['Alfresco', 'Bible', 'Fathers', 'MyCollab', 'Koha' , 'MediaWiki', 'Moodle', 'RequestTracker', 'SuiteCRM', 'TikiWiki', 'Wordpress', 'CJSHayward']: /usr/local/websites/home/www/configure/index.cgi, referer: http : // localhost /
[Tue Aug Aug. 16: 25: 34.267490 2017] [cgi: error] [pid 16429] [client 127.0.0.1:40600] AH01215: AlfrescoAlfrescoBibleBibleFathersFathersMyCollabMyCollabKohaKohaMediaWikiMediaWikiMoodleMoodleRequestTrackerRequestTrackerSuiteCRMSuiteCRMTikiWikiTikiWiki: /usr/local/websites/home/www/configure/index.cgi, referer : http: // localhost /

I'm surprised it repeats itself once over a single line (redundant list concatenation), instead of repeating what repr

seems to recognize a list of strings, which is what I assumed.

How can I get the loop to iterate over "Alfresco", "Bible", etc. through "CJSHayward"?

Thank,

+3


source to share





All Articles