[gcompris] Fixed administration to accept UTF-8 user entries.



commit 23283191039d2b4a86ab72734c1a9dbf12a99f92
Author: Bruno Coudoin <bruno coudoin gcompris net>
Date:   Fri Jan 17 23:09:19 2014 +0100

    Fixed administration to accept UTF-8 user entries.

 src/administration-activity/admin/class_edit.py    |   20 ++++++++++----------
 src/administration-activity/admin/group_edit.py    |    6 +++---
 src/administration-activity/admin/profile_edit.py  |    4 ++--
 .../admin/profile_widget.py                        |    2 +-
 src/administration-activity/admin/user_edit.py     |    6 +++---
 5 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/src/administration-activity/admin/class_edit.py b/src/administration-activity/admin/class_edit.py
index d368354..155ebd4 100644
--- a/src/administration-activity/admin/class_edit.py
+++ b/src/administration-activity/admin/class_edit.py
@@ -338,9 +338,12 @@ class ClassEdit(gtk.Window):
         # Now everything is correct, create the class
         #
 
+        self.class_name   = unicode(self.entry_class.get_text())
+        self.teacher_name = unicode(self.entry_teacher.get_text())
+
         class_data = (self.class_id,
-                      self.entry_class.get_text(),
-                      self.entry_teacher.get_text()
+                      self.class_name,
+                      self.teacher_name
                       )
 
         if(self.new_class):
@@ -348,16 +351,13 @@ class ClassEdit(gtk.Window):
 
         # Save the changes in the base
         self.cur.execute('UPDATE class set name=?,teacher=? where class_id=?',
-                         (self.entry_class.get_text(),
-                          self.entry_teacher.get_text(),
+                         (self.class_name,
+                          self.teacher_name,
                           self.class_id));
         self.con.commit()
 
         # Close the dialog window now
         # (The close code will refresh the class_list)
-        self.class_name   = self.entry_class.get_text()
-        self.teacher_name = self.entry_teacher.get_text()
-
         self.destroy()
 
 
@@ -369,7 +369,7 @@ class ClassEdit(gtk.Window):
 
         # Check the login do not exist already
         self.cur.execute('SELECT name FROM class WHERE name=?',
-                         (self.entry_class.get_text(),))
+                         (unicode(self.entry_class.get_text()),))
         if(self.cur.fetchone()):
             dialog = gtk.MessageDialog(None,
                                        gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
@@ -386,8 +386,8 @@ class ClassEdit(gtk.Window):
                          (group_id, self.class_id));
 
         class_data = (self.class_id,
-                      self.entry_class.get_text(),
-                      self.entry_teacher.get_text(),
+                      unicode(self.entry_class.get_text()),
+                      unicode(self.entry_teacher.get_text()),
                       group_id
                       )
 
diff --git a/src/administration-activity/admin/group_edit.py b/src/administration-activity/admin/group_edit.py
index 1657088..e70cadf 100644
--- a/src/administration-activity/admin/group_edit.py
+++ b/src/administration-activity/admin/group_edit.py
@@ -358,7 +358,7 @@ class GroupEdit(gtk.Window):
         if(self.entry_group.get_text() != self.group_name):
             # Check the group does not exist already
             self.cur.execute('SELECT name FROM groups WHERE name=?',
-                             (self.entry_group.get_text(),))
+                             (unicode(self.entry_group.get_text()),))
             if(self.cur.fetchone()):
                 dialog = gtk.MessageDialog(None,
                                            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
@@ -373,9 +373,9 @@ class GroupEdit(gtk.Window):
         #
 
         group_data = (self.group_id,
-                      self.entry_group.get_text(),
+                      unicode(self.entry_group.get_text()),
                       self.class_id,
-                      self.entry_description.get_text()
+                      unicode(self.entry_description.get_text())
                       )
 
         if(self.new_group):
diff --git a/src/administration-activity/admin/profile_edit.py 
b/src/administration-activity/admin/profile_edit.py
index 421126f..be2e624 100644
--- a/src/administration-activity/admin/profile_edit.py
+++ b/src/administration-activity/admin/profile_edit.py
@@ -132,8 +132,8 @@ class ProfileEdit(gtk.Window):
             dialog.destroy()
             return
 
-        self.profile_widget.ok(self.entry_profile.get_text().strip(),
-                self.entry_description.get_text())
+        self.profile_widget.ok(unicode(self.entry_profile.get_text().strip()),
+                unicode(self.entry_description.get_text()))
 
         # Close the dialog window now
         self.profile_list.reload_profile()
diff --git a/src/administration-activity/admin/profile_widget.py 
b/src/administration-activity/admin/profile_widget.py
index 19e09bc..7eb9f16 100644
--- a/src/administration-activity/admin/profile_widget.py
+++ b/src/administration-activity/admin/profile_widget.py
@@ -283,7 +283,7 @@ class ProfileWidget(gtk.HBox):
         if(self.new_profile):
             # Check the login do not exist already
             self.cur.execute('SELECT name FROM profiles WHERE name=?',
-                             (entry_profile,))
+                             (unicode(entry_profile),))
             if(self.cur.fetchone()):
                 dialog = gtk.MessageDialog(None,
                                            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
diff --git a/src/administration-activity/admin/user_edit.py b/src/administration-activity/admin/user_edit.py
index 0a03c1f..d5861cd 100644
--- a/src/administration-activity/admin/user_edit.py
+++ b/src/administration-activity/admin/user_edit.py
@@ -176,9 +176,9 @@ class UserEdit(gtk.Window):
         # Now everything is correct, create the user
         #
         user_data = (self.user_id,
-                     self.entry_login.get_text(),
-                     self.entry_firstname.get_text(),
-                     self.entry_lastname.get_text(),
+                     unicode(self.entry_login.get_text()),
+                     unicode(self.entry_firstname.get_text()),
+                     unicode(self.entry_lastname.get_text()),
                      self.entry_birthdate.get_text(),
                      self.class_id
                      )


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]