da046034 by Marcos Cano

Merge branch 'ascii-codec-fix' into 'master'

BOM Ascii codec fix

See merge request !1
2 parents 0dece759 2625a566
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.0" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
<httpHandlers>
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
</httpHandlers>
</system.web>
<appSettings>
<add key="ConfigurationService:Url" value="[[{ConfigurationServiceUrl}]]" />
<add key="Service:Name" value="ServiceProvider:AdsDeliveryPublisherMakesAndModelsMapping" />
<add key="Service:ClientName" value="ServiceClient:AdsDeliveryPublisherMakesAndModelsMapping" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="Service:TimeOut" value="4000" />
<add key="Service:ThreadPool" value="5" />
<add key="Logger:Revision" value="0" />
<add key="ConfigurationService:LocalConfigurationPath" value="[[{APP_HOME}]]/configurations/" />
</appSettings>
<nlog autoReload="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- FOR DEBUGGING internalLogToConsole="true" internalLogLevel="Debug" throwExceptions="true" -->
<variable name="logdir" value="/var/log" />
<!--variable name="logdir" value="/home/ubuntu/logs/"/-->
<targets>
<target xsi:type="File" name="fileLogError" fileName="${logdir}/errors.log" layout="${message}$$" archiveEvery="Hour" archiveNumbering="Date" archiveDateFormat="yyyy-MM-dd-hh" archiveFileName="${logdir}/errors.{#}.log" />
<target xsi:type="File" name="fileLogDebug" fileName="${logdir}/debug.log" layout="${message}$$" archiveEvery="Hour" archiveNumbering="Date" archiveDateFormat="yyyy-MM-dd-hh" archiveFileName="${logdir}/debug.{#}.log" />
<target xsi:type="File" name="fileLogInfo" fileName="${logdir}/access.log" layout="${message}$$" archiveEvery="Hour" archiveNumbering="Date" archiveDateFormat="yyyy-MM-dd-hh" archiveFileName="${logdir}/access.{#}.log" />
<target xsi:type="File" name="standardOutputSource" fileName="${logdir}/stdout.log" layout="${message}$$" archiveEvery="Hour" archiveNumbering="Date" archiveDateFormat="yyyyMMddHH" archiveFileName="${logdir}/stdout.{#}.log" keepFileOpen="True" concurrentWrites="False" />
</targets>
<rules>
<logger name="logs" level="Error" writeTo="fileLogError" />
<logger name="logs" level="Debug" writeTo="fileLogDebug" />
<logger name="logs" level="Info" writeTo="fileLogInfo" />
<logger name="standardOutputLog" level="Error" writeTo="standardOutputSource" />
</rules>
</nlog>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.9.9.0" newVersion="6.9.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="protobuf-net" publicKeyToken="257b51d87d2e4d67" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.668" newVersion="2.0.0.668" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data></configuration>
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.0" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
<httpHandlers>
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
</httpHandlers>
</system.web>
<appSettings>
<add key="ConfigurationService:Url" value="[[{ConfigurationServiceUrl}]]" />
<add key="Service:Name" value="ServiceProvider:AdsDeliveryPublisherMakesAndModelsMapping" />
<add key="Service:ClientName" value="ServiceClient:AdsDeliveryPublisherMakesAndModelsMapping" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="Service:TimeOut" value="4000" />
<add key="Service:ThreadPool" value="5" />
<add key="Logger:Revision" value="0" />
<add key="ConfigurationService:LocalConfigurationPath" value="[[{APP_HOME}]]/configurations/" />
</appSettings>
<nlog autoReload="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- FOR DEBUGGING internalLogToConsole="true" internalLogLevel="Debug" throwExceptions="true" -->
<variable name="logdir" value="/var/log" />
<!--variable name="logdir" value="/home/ubuntu/logs/"/-->
<targets>
<target xsi:type="File" name="fileLogError" fileName="${logdir}/errors.log" layout="${message}$$" archiveEvery="Hour" archiveNumbering="Date" archiveDateFormat="yyyy-MM-dd-hh" archiveFileName="${logdir}/errors.{#}.log" />
<target xsi:type="File" name="fileLogDebug" fileName="${logdir}/debug.log" layout="${message}$$" archiveEvery="Hour" archiveNumbering="Date" archiveDateFormat="yyyy-MM-dd-hh" archiveFileName="${logdir}/debug.{#}.log" />
<target xsi:type="File" name="fileLogInfo" fileName="${logdir}/access.log" layout="${message}$$" archiveEvery="Hour" archiveNumbering="Date" archiveDateFormat="yyyy-MM-dd-hh" archiveFileName="${logdir}/access.{#}.log" />
<target xsi:type="File" name="standardOutputSource" fileName="${logdir}/stdout.log" layout="${message}$$" archiveEvery="Hour" archiveNumbering="Date" archiveDateFormat="yyyyMMddHH" archiveFileName="${logdir}/stdout.{#}.log" keepFileOpen="True" concurrentWrites="False" />
</targets>
<rules>
<logger name="logs" level="Error" writeTo="fileLogError" />
<logger name="logs" level="Debug" writeTo="fileLogDebug" />
<logger name="logs" level="Info" writeTo="fileLogInfo" />
<logger name="standardOutputLog" level="Error" writeTo="standardOutputSource" />
</rules>
</nlog>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.9.9.0" newVersion="6.9.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="protobuf-net" publicKeyToken="257b51d87d2e4d67" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.668" newVersion="2.0.0.668" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data></configuration>
......@@ -58,23 +58,26 @@ def engine(ifile,ofile,vars):
template_content = open(ifile, "r").read()
template= MyTemplate(template_content)
#print 'MATCHES:', t.pattern.findall(t.template)
#print 'MATCHES:', template.pattern.findall(template.template)
matches = template.pattern.findall(template.template)
if len(matches):
#print '[ MATCHES ] - ', matches
outputText = template.safe_substitute(vars)
#print "[ TEMPLATING ] - %s "%ifile
if printit:
#print "AFTER TEMPLATE:"
#print outputText
print outputText.encode('ascii', 'ignore')
else:
f = open(ofile,'w')
f.write(outputText.encode('ascii', 'ignore'))
f.close()
try:
if printit:
print outputText.encode('ascii', 'ignore')
else:
f = open(ofile,'w')
f.write(outputText.encode('ascii', 'ignore'))
f.close()
except UnicodeDecodeError:
if printit:
print str(outputText)
else:
f = open(ofile,'w')
f.write(str(outputText))
f.close()
......