[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5101 - in trunk: gnue-appserver gnue-appserver/samples gnue-common/src/
From: |
johannes |
Subject: |
r5101 - in trunk: gnue-appserver gnue-appserver/samples gnue-common/src/schema/scripter gnue-common/src/schema/scripter/processors |
Date: |
Thu, 12 Feb 2004 08:49:29 -0600 (CST) |
Author: johannes
Date: 2004-02-12 08:49:28 -0600 (Thu, 12 Feb 2004)
New Revision: 5101
Modified:
trunk/gnue-appserver/BUGS
trunk/gnue-appserver/samples/Makefile
trunk/gnue-common/src/schema/scripter/Scripter.py
trunk/gnue-common/src/schema/scripter/processors/Base.py
trunk/gnue-common/src/schema/scripter/processors/postgresql.py
Log:
Make sure to use UTF-8 encoding on output to SQL files
Modified: trunk/gnue-appserver/BUGS
===================================================================
--- trunk/gnue-appserver/BUGS 2004-02-12 14:24:22 UTC (rev 5100)
+++ trunk/gnue-appserver/BUGS 2004-02-12 14:49:28 UTC (rev 5101)
@@ -19,3 +19,6 @@
* Not all strings are translatable, i.e. _() has to put around all strings
+* What happens if a classname or a property contains non-ASCII characters. What
+ does gnue-schema or geasGsdGen with items like that?
+
Modified: trunk/gnue-appserver/samples/Makefile
===================================================================
--- trunk/gnue-appserver/samples/Makefile 2004-02-12 14:24:22 UTC (rev
5100)
+++ trunk/gnue-appserver/samples/Makefile 2004-02-12 14:49:28 UTC (rev
5101)
@@ -31,7 +31,7 @@
PROCESSORS = postgresql interbase oracle mysql
# Which files to process
-SRC = base.gsd test.gsd
+SRC = base.gsd auth.gsd sample.gsd
OPTS =
Modified: trunk/gnue-common/src/schema/scripter/Scripter.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/Scripter.py 2004-02-12 14:24:22 UTC
(rev 5100)
+++ trunk/gnue-common/src/schema/scripter/Scripter.py 2004-02-12 14:49:28 UTC
(rev 5101)
@@ -18,7 +18,7 @@
#
# Copyright 2002-2004 Free Software Foundation
#
-# $Id: $
+# $Id$
#
from gnue.common import VERSION
@@ -276,7 +276,7 @@
self.destination.write ("\n")
for line in self.processor.comment (_("\nData for %s\n") % data.name):
- self.destination.write (line + "\n")
+ self.destination.write (line.encode ('utf-8') + "\n")
sObject.walk (self.__data_rows, dataDef = data)
Modified: trunk/gnue-common/src/schema/scripter/processors/Base.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/processors/Base.py 2004-02-12
14:24:22 UTC (rev 5100)
+++ trunk/gnue-common/src/schema/scripter/processors/Base.py 2004-02-12
14:49:28 UTC (rev 5101)
@@ -18,7 +18,7 @@
#
# Copyright 2002-2004 Free Software Foundation
#
-# $Id: $
+# $Id$
from string import join
@@ -63,6 +63,12 @@
# ---------------------------------------------------------------------------
+ # Write a text to the destination, and make sure it's utf-8 encoded
+ # ---------------------------------------------------------------------------
+ def _dumpText (self, text):
+ self.destination.write (text.encode ('utf-8'))
+
+ # ---------------------------------------------------------------------------
# Create an identifier for a sequence-like thing
# ---------------------------------------------------------------------------
def _getSequenceName (self, tablename, gsObject):
@@ -183,21 +189,21 @@
# Now dump the table definition
for line in self.comment (_("\nCreate table '%s'\n") % tableDef.name):
- self.destination.write (line + "\n")
+ self._dumpText (line + "\n")
# Create the prologue
if len (tableDef.prologue):
- self.destination.write (join (tableDef.prologue, ";\n") + ";\n")
+ self._dumpText (join (tableDef.prologue, ";\n") + ";\n")
# Add the fields and postfields
- self.destination.write ("CREATE TABLE %s\n (" % tableDef.name)
- self.destination.write (join (tableDef.fields + tableDef.postfields,
+ self._dumpText ("CREATE TABLE %s\n (" % tableDef.name)
+ self._dumpText (join (tableDef.fields + tableDef.postfields,
",\n ") + ");\n")
# Create the epilogue
if len (tableDef.epilogue):
- self.destination.write (join (tableDef.epilogue, "\n") + "\n")
+ self._dumpText (join (tableDef.epilogue, "\n") + "\n")
- self.destination.write ("\n");
+ self._dumpText ("\n");
# ---------------------------------------------------------------------------
@@ -212,13 +218,13 @@
self._processData (dataDef)
if len (dataDef.prologue):
- self.destination.write (join (dataDef.prologue, "\n"))
+ self._dumpText (join (dataDef.prologue, "\n"))
if len (dataDef.lines):
- self.destination.write (join (dataDef.lines, "\n") + "\n")
+ self._dumpText (join (dataDef.lines, "\n") + "\n")
if len (dataDef.epilogue):
- self.destination.write (join (dataDef.epilogue, "\n") + "\n")
+ self._dumpText (join (dataDef.epilogue, "\n") + "\n")
# ---------------------------------------------------------------------------
Modified: trunk/gnue-common/src/schema/scripter/processors/postgresql.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/processors/postgresql.py
2004-02-12 14:24:22 UTC (rev 5100)
+++ trunk/gnue-common/src/schema/scripter/processors/postgresql.py
2004-02-12 14:49:28 UTC (rev 5101)
@@ -18,7 +18,7 @@
#
# Copyright 2002-2004 Free Software Foundation
#
-# $Id: $
+# $Id$
#
from gnue.common.schema.scripter.processors.SQL import SQLProcessor
@@ -100,3 +100,15 @@
def boolean (self, gsField):
return "boolean"
+ # ---------------------------------------------------------------------------
+ # Before starting schema data, set encoding to UTF-8
+ # ---------------------------------------------------------------------------
+ def startSchema (self):
+ self._dumpText ("\\encoding utf8\n")
+
+
+ # ---------------------------------------------------------------------------
+ # Before starting schema data, set encoding to UTF-8
+ # ---------------------------------------------------------------------------
+ def startData (self):
+ self._dumpText ("\\encoding utf8\n")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5101 - in trunk: gnue-appserver gnue-appserver/samples gnue-common/src/schema/scripter gnue-common/src/schema/scripter/processors,
johannes <=