def _merge_common_settings(self, output):
        try:
            cfg = self.data.xpath('//Admin')[0]
            output.write("\nADMINS = (\n  ('%s',\n  '%s'),\n)" % (cfg.get('user'), cfg.get('email')))
            output.write("\nMANAGERS = ADMINS\n")

            output.write("\nSECRET_KEY = '%s'\n" % "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)]))

            cfg = self.data.xpath('//Project')[0]
            root_dir = cfg.get('root')

            # Consolidated web-readable temp directory
            webtmp = cfg.get('temp')
            if not webtmp:
                webtmp = '%s/../local/reports/' % root_dir

            output.write("\nWEB_TEMP = '%s'\n" % webtmp)

            # Reporting is optional
            cfg = self.data.xpath('//Reporting')
            if cfg is not None:
                bardcfg = cfg[0].find('BardConfigs/BardConfig')
                calccfg = cfg[0].find('CalculatorReports')

                # BARD
                if bardcfg is not None:
                    cfg = bardcfg
                    output.write("\nREPORTS_ENABLED = 'BARD'\n")

                # Calculator reports
                elif calccfg is not None:
                    output.write("\nREPORTS_ENABLED = 'CALC'\n")
                else:
                    output.write("\nREPORTS_ENABLED = None\n")
            else:
                # Write this setting to the settings.
                output.write("\nREPORTS_ENABLED = None\n")

            return True

        except Exception, ex:
            # An error occurred during the processing of the settings file
            logging.warning(traceback.format_exc())

            return False
Write common configuration settings to the output file.
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/__init__.py/StoredConfig._merge_common_settings