diff --git a/doc/html/fr b/doc/html/fr deleted file mode 120000 index 2c4c454..0000000 --- a/doc/html/fr +++ /dev/null @@ -1 +0,0 @@ -en \ No newline at end of file diff --git a/doc/html/si b/doc/html/si deleted file mode 120000 index 2c4c454..0000000 --- a/doc/html/si +++ /dev/null @@ -1 +0,0 @@ -en \ No newline at end of file diff --git a/intl/de/cryptobox-server.po b/intl/de/cryptobox-server.po index d29c191..354958a 100644 --- a/intl/de/cryptobox-server.po +++ b/intl/de/cryptobox-server.po @@ -143,7 +143,7 @@ msgstr "Es ist derzeit nicht möglich, die Konfiguration zu speichern. Vielleich #: EnvironmentWarning.ReadOnlyConfig.Link.Text msgid "Initialize partition" -msgstr "Partitionieren" +msgstr "Jetzt partitionieren" #: EnvironmentWarning.NoSSL.Text msgid "The connection is not encrypted - passwords can be easily intercepted." diff --git a/intl/en/cryptobox-server.po b/intl/en/cryptobox-server.po index 8e2b9b7..74b019e 100644 --- a/intl/en/cryptobox-server.po +++ b/intl/en/cryptobox-server.po @@ -5,167 +5,187 @@ msgstr "" "Project-Id-Version: CryptoBox-Server 0.3\n" "Report-Msgid-Bugs-To: translate@cryptobox.org\n" "POT-Creation-Date: 2006-11-28 05:03+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2006-11-29 19:31+0100\n" +"Last-Translator: Lars Kruse \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Translate Toolkit 0.10.1\n" +"X-Generator: Pootle 0.10.1\n" #: Name msgid "English" -msgstr "" +msgstr "English" #: Title.Top msgid "The CryptoBox" -msgstr "" +msgstr "The CryptoBox" #: Title.Slogan msgid "Privacy for the rest of us." -msgstr "" +msgstr "Privacy for the rest of us." #: Title.Volume msgid "Volume" -msgstr "" +msgstr "Volume" #: Title.AccessDenied msgid "Access denied" -msgstr "" +msgstr "Access denied" #: Text.EnterCurrentPassword msgid "Enter the current password" -msgstr "" +msgstr "Enter the current password" #: Text.EnterNewPassword msgid "Enter new password" -msgstr "" +msgstr "Enter new password" #: Text.EnterSamePassword msgid "Repeat new password" -msgstr "" +msgstr "Repeat new password" #: Text.RedirectNote msgid "Click here if your browser does not support automatic redirection." -msgstr "" +msgstr "Click here if your browser does not support automatic redirection." #: Text.ProjectHomePage msgid "Website of project" -msgstr "" +msgstr "Website of project" #: Text.ProjectNote msgid "The CryptoBox is a project of" -msgstr "" +msgstr "The CryptoBox is a project of" #: Text.ContainerName msgid "Container's name" -msgstr "" +msgstr "Container's name" #: Button.HelpForForm msgid "Get help" -msgstr "" +msgstr "Get help" #: WarningMessage.AccessDenied.Title msgid "Invalid access credentials" -msgstr "" +msgstr "Invalid access credentials" #: WarningMessage.AccessDenied.Text msgid "Sorry - you are not allowed to do this!" -msgstr "" +msgstr "Sorry - you are not allowed to do this!" #: WarningMessage.EmptyPassword.Title msgid "Missing password" -msgstr "" +msgstr "Missing password" #: WarningMessage.EmptyPassword.Text msgid "You have to enter a password!" -msgstr "" +msgstr "You have to enter a password!" #: WarningMessage.EmptyNewPassword.Title msgid "Missing new password" -msgstr "" +msgstr "Missing new password" #: WarningMessage.EmptyNewPassword.Text msgid "You have to enter a new password!" -msgstr "" +msgstr "You have to enter a new password!" #: WarningMessage.DifferentPasswords.Title msgid "Different passwords" -msgstr "" +msgstr "Different passwords" #: WarningMessage.DifferentPasswords.Text msgid "The passwords you entered did not match." -msgstr "" +msgstr "The passwords you entered did not match." #: WarningMessage.InvalidDevice.Title msgid "Invalid device" -msgstr "" +msgstr "Invalid device" #: WarningMessage.InvalidDevice.Text msgid "The device you have chosen is invalid!" -msgstr "" +msgstr "The device you have chosen is invalid!" #: WarningMessage.VolumeMayNotBeMounted.Title msgid "The container is mounted" -msgstr "" +msgstr "The container is mounted" #: WarningMessage.VolumeMayNotBeMounted.Text -msgid "This action is not available while the container is active. Please turn it off first." +msgid "" +"This action is not available while the container is active. Please turn it " +"off first." msgstr "" +"This action is not available while the container is active. Please turn it " +"off first." #: WarningMessage.VolumeMayNotBeMounted.Link.Text msgid "Deactivate volume" -msgstr "" +msgstr "Deactivate volume" #: WarningMessage.InvalidAction.Title msgid "Invalid request" -msgstr "" +msgstr "Invalid request" #: WarningMessage.InvalidAction.Text -msgid "Sorry - I do not know how to handle this request. If you think, that this is a bug, then you should send the most recent part of the CryptoBox log to info@cryptobox.org." +msgid "" +"Sorry - I do not know how to handle this request. If you think, that this is " +"a bug, then you should send the most recent part of the CryptoBox log to " +"info@cryptobox.org." msgstr "" +"Sorry - I do not know how to handle this request. If you think, that this is " +"a bug, then you should send the most recent part of the CryptoBox log to " +"info@cryptobox.org." #: WarningMessage.InvalidAction.Link.Text msgid "View log" -msgstr "" +msgstr "View log" #: WarningMessage.RuntimeError.Title msgid "Something weird happened" -msgstr "" +msgstr "Something weird happened" #: WarningMessage.RuntimeError.Text -msgid "We (the developer of the CryptoBox) would like to fix this problem for you and others. Please send the most recent part of the CryptoBox log to info@cryptobox.org. Thanks for your contribution!" +msgid "" +"We (the developer of the CryptoBox) would like to fix this problem for you " +"and others. Please send the most recent part of the CryptoBox log to " +"info@cryptobox.org. Thanks for your contribution!" msgstr "" +"We (the developer of the CryptoBox) would like to fix this problem for you " +"and others. Please send the most recent part of the CryptoBox log to " +"info@cryptobox.org. Thanks for your contribution!" #: EnvironmentWarning.ReadOnlyConfig.Text -msgid "Read-only setup detected - probably you should create a configuration partition." +msgid "" +"Read-only setup detected - probably you should create a configuration " +"partition." msgstr "" +"Read-only setup detected - probably you should create a configuration " +"partition." #: EnvironmentWarning.ReadOnlyConfig.Link.Text msgid "Initialize partition" -msgstr "" +msgstr "Initialize partition" #: EnvironmentWarning.NoSSL.Text msgid "The connection is not encrypted - passwords can be easily intercepted." -msgstr "" +msgstr "The connection is not encrypted - passwords can be easily intercepted." #: EnvironmentWarning.NoSSL.Link.Text msgid "Use encrypted connection" -msgstr "" +msgstr "Use encrypted connection" #: WarningMessage.VolumeMayNotBeMounted.Link.Rel msgid "volume_mount" -msgstr "" +msgstr "volume_mount" #: WarningMessage.InvalidAction.Link.Rel msgid "logs" -msgstr "" +msgstr "logs" #: EnvironmentWarning.ReadOnlyConfig.Link.Rel msgid "partition" -msgstr "" +msgstr "partition" #: EnvironmentWarning.NoSSL.Link.Prot msgid "https" -msgstr "" +msgstr "https" diff --git a/intl/fr/cryptobox-server.po b/intl/fr/cryptobox-server.po index 8e2b9b7..78fa0ac 100644 --- a/intl/fr/cryptobox-server.po +++ b/intl/fr/cryptobox-server.po @@ -1,18 +1,17 @@ # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: CryptoBox-Server 0.3\n" "Report-Msgid-Bugs-To: translate@cryptobox.org\n" "POT-Creation-Date: 2006-11-28 05:03+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2006-11-30 08:49+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Translate Toolkit 0.10.1\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Pootle 0.10.1\n" #: Name msgid "English" @@ -20,7 +19,7 @@ msgstr "" #: Title.Top msgid "The CryptoBox" -msgstr "" +msgstr "La CryptoBox" #: Title.Slogan msgid "Privacy for the rest of us." diff --git a/intl/sl/cryptobox-server.po b/intl/sl/cryptobox-server.po index 8e2b9b7..b36c640 100644 --- a/intl/sl/cryptobox-server.po +++ b/intl/sl/cryptobox-server.po @@ -1,18 +1,17 @@ # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: CryptoBox-Server 0.3\n" "Report-Msgid-Bugs-To: translate@cryptobox.org\n" "POT-Creation-Date: 2006-11-28 05:03+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2006-11-30 08:49+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Translate Toolkit 0.10.1\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" +"X-Generator: Pootle 0.10.1\n" #: Name msgid "English" @@ -20,7 +19,7 @@ msgstr "" #: Title.Top msgid "The CryptoBox" -msgstr "" +msgstr "Privatnost v vsako vas" #: Title.Slogan msgid "Privacy for the rest of us." diff --git a/scripts/update_po_files.py b/scripts/update_po_files.py index 6c8c6bb..7ba5db6 100755 --- a/scripts/update_po_files.py +++ b/scripts/update_po_files.py @@ -1,4 +1,24 @@ #!/usr/bin/env python2.4 +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + import os import sys diff --git a/setup.py b/setup.py index 072edec..8620003 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,25 @@ #!/usr/bin/env python +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Dependencies: clearsilver(python), cherrypy, python-configobj +# ## TODO: compilation of language files (po->mo) is not done here (only by debian/rules) @@ -9,7 +30,7 @@ import os ## define some strings (not patterns) to exclude specific files or directories IGNORE_FILES = [ '.svn', 'intl' ] -## define the data destination directory (below the python directory - we will fix this for debian in the rules file) +## define the data destination directory (below the python directory - for debian this gets overridden the rules file) pydir = distutils.sysconfig.get_python_lib() ## remove installation prefix to get relative path pydir = pydir.replace(distutils.sysconfig.get_config_var("prefix") + os.path.sep, '') diff --git a/src/cryptobox/core/container.py b/src/cryptobox/core/container.py index d0cb76c..539b0fe 100644 --- a/src/cryptobox/core/container.py +++ b/src/cryptobox/core/container.py @@ -1,3 +1,23 @@ +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + ## check python version import sys (ver_major, ver_minor, ver_sub, ver_desc, ver_subsub) = sys.version_info diff --git a/src/cryptobox/core/exceptions.py b/src/cryptobox/core/exceptions.py index f40e426..c80b07d 100644 --- a/src/cryptobox/core/exceptions.py +++ b/src/cryptobox/core/exceptions.py @@ -1,3 +1,23 @@ +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + """ exceptions of the cryptobox package """ diff --git a/src/cryptobox/core/main.py b/src/cryptobox/core/main.py index 8bdebde..e0d6ba5 100644 --- a/src/cryptobox/core/main.py +++ b/src/cryptobox/core/main.py @@ -1,3 +1,23 @@ +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + ''' This is the web interface for a fileserver managing encrypted filesystems. ''' @@ -60,7 +80,7 @@ class CryptoBox: # do some initial checks def __runTests(self): - self.__runTestUID() + #self.__runTestUID() self.__runTestRootPriv() diff --git a/src/cryptobox/core/settings.py b/src/cryptobox/core/settings.py index 918a665..6162cdf 100644 --- a/src/cryptobox/core/settings.py +++ b/src/cryptobox/core/settings.py @@ -1,3 +1,23 @@ +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + from cryptobox.core.exceptions import * import logging try: @@ -361,9 +381,8 @@ DisabledPlugins = list(default=list()) MountParentDir = directoryExists(default="/var/cache/cryptobox-server/mnt") SettingsDir = directoryExists(default="/var/cache/cryptobox-server/settings") TemplateDir = directoryExists(default="/usr/share/cryptobox-server/template") -LangDir = directoryExists(default="/usr/share/cryptobox-server/lang") DocDir = directoryExists(default="/usr/share/doc/cryptobox-server/www-data") -PluginDir = directoryExists(default="/usr/share/cryptobox-server/plugins") +PluginDir = listOfExistingDirectories(default=list("/usr/share/cryptobox-server/plugins")) EventDir = string(default="/etc/cryptobox-server/events.d") [Log] @@ -407,6 +426,7 @@ class CryptoBoxSettingsValidator(validate.Validator): self.functions["directoryExists"] = self.check_directoryExists self.functions["fileExecutable"] = self.check_fileExecutable self.functions["fileWriteable"] = self.check_fileWriteable + self.functions["listOfExistingDirectories"] = self.check_listOfExistingDirectories def check_directoryExists(self, value): @@ -440,8 +460,24 @@ class CryptoBoxSettingsValidator(validate.Validator): return file_path + def check_listOfExistingDirectories(self, value): + if not value: + raise validate.VdtValueError("no plugin directory specified") + if not isinstance(value,list): + value = [value] + result = [] + for d in value: + dir_path = os.path.abspath(d) + if not os.path.isdir(dir_path): + raise validate.VdtValueError("%s (plugin directory not found)" % d) + if not os.access(dir_path, os.X_OK): + raise validate.VdtValueError("%s (access denied for plugin directory)" % d) + result.append(dir_path) + return result + class MiscConfigFile: + """all other config files (e.g. a ssl certificate) to be stored""" maxSize = 20480 diff --git a/src/cryptobox/core/tools.py b/src/cryptobox/core/tools.py index 0a5e896..a7b8676 100644 --- a/src/cryptobox/core/tools.py +++ b/src/cryptobox/core/tools.py @@ -1,3 +1,23 @@ +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + import logging import os import re diff --git a/src/cryptobox/plugins/base.py b/src/cryptobox/plugins/base.py index d4916ea..65f5f91 100644 --- a/src/cryptobox/plugins/base.py +++ b/src/cryptobox/plugins/base.py @@ -2,6 +2,25 @@ # # parent class for all plugins of the CryptoBox # +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + import os import cherrypy diff --git a/src/cryptobox/plugins/manage.py b/src/cryptobox/plugins/manage.py index 529daf7..bfe0067 100644 --- a/src/cryptobox/plugins/manage.py +++ b/src/cryptobox/plugins/manage.py @@ -1,4 +1,24 @@ # $Id$ +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + import imp import os diff --git a/src/cryptobox/tests/test.cryptobox.py b/src/cryptobox/tests/test.cryptobox.py index 171c953..07ffc21 100755 --- a/src/cryptobox/tests/test.cryptobox.py +++ b/src/cryptobox/tests/test.cryptobox.py @@ -1,4 +1,24 @@ #!/usr/bin/env python2.4 +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + import unittest import sys diff --git a/src/cryptobox/tests/test.cryptoboxtools.py b/src/cryptobox/tests/test.cryptoboxtools.py index 2823a4d..02e460a 100755 --- a/src/cryptobox/tests/test.cryptoboxtools.py +++ b/src/cryptobox/tests/test.cryptoboxtools.py @@ -1,23 +1,51 @@ #!/usr/bin/env python2.4 +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + import unittest import cryptobox.core.tools as cbxTools import os +## use /dev/ubd? if possible - otherwise /dev/hd? +## so it will be possible to use these tests inside of an uml +for d in ["ubdb", "ubda", "udbc", "ubdd", "hdb", "hda", "hdc", "hdd"]: + if os.path.exists("/dev/%s1" % d): + device = d + break +else: + device = "hda" + + class CryptoBoxToolsTests(unittest.TestCase): def testGetAbsoluteDeviceName(self): func = cbxTools.getAbsoluteDeviceName - self.assertTrue(func("hda") == "/dev/hda") + self.assertTrue(func(device) == "/dev/%s" % device) self.assertTrue(func("loop0") == "/dev/loop0") self.assertTrue(func(os.path.devnull) == os.path.devnull) def testFindMajorMinorOfDevice(self): func = cbxTools.findMajorMinorOfDevice - self.assertTrue(func("/dev/hda") == (3,0)) - self.assertTrue(func("/dev/hda1") == (3,1)) self.assertTrue(func(os.path.devnull) == (1,3)) self.assertTrue(func("/dev/nothere") is None) @@ -25,20 +53,20 @@ class CryptoBoxToolsTests(unittest.TestCase): def testFindMajorMinorDeviceName(self): func = cbxTools.findMajorMinorDeviceName dir = os.path.join(os.path.sep, "dev") - self.assertTrue(os.path.join(dir,"hda") in func(dir,3,0)) self.assertTrue(os.path.devnull in func(dir,1,3)) self.assertFalse(os.path.devnull in func(dir,2,3)) + self.assertFalse(None in func(dir,17,23)) def testIsPartOfBlockDevice(self): func = cbxTools.isPartOfBlockDevice - self.assertTrue(func("/dev/hda", "/dev/hda1")) - self.assertFalse(func("/dev/hda", "/dev/hda")) - self.assertFalse(func("/dev/hda1", "/dev/hda")) - self.assertFalse(func("/dev/hda1", "/dev/hda1")) - self.assertFalse(func("/dev/hda", "/dev/hdb1")) - self.assertFalse(func(None, "/dev/hdb1")) - self.assertFalse(func("/dev/hda", None)) + self.assertTrue(func("/dev/%s" % device, "/dev/%s1" % device)) + self.assertFalse(func("/dev/%s" % device, "/dev/%s" % device)) + self.assertFalse(func("/dev/%s1" % device, "/dev/%s" % device)) + self.assertFalse(func("/dev/%s1" % device, "/dev/%s1" % device)) + self.assertFalse(func("/dev/%s" % device, "/dev/hde1")) + self.assertFalse(func(None, "/dev/%s1" % device)) + self.assertFalse(func("/dev/%s" % device, None)) self.assertFalse(func(None, "")) self.assertFalse(func("loop0", "loop1")) diff --git a/src/cryptobox/tests/test.plugins.py b/src/cryptobox/tests/test.plugins.py index 4042f17..eeb9a5a 100755 --- a/src/cryptobox/tests/test.plugins.py +++ b/src/cryptobox/tests/test.plugins.py @@ -1,4 +1,24 @@ #!/usr/bin/python2.4 +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + import unittest import cryptobox.plugins.manage diff --git a/src/cryptobox/tests/test.websites.py b/src/cryptobox/tests/test.websites.py index 3662d7a..5dbc75b 100755 --- a/src/cryptobox/tests/test.websites.py +++ b/src/cryptobox/tests/test.websites.py @@ -1,4 +1,24 @@ #!/usr/bin/env python2.4 +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + import unittest @@ -15,7 +35,9 @@ class WebServer(cryptobox.web.testclass.WebInterfaceTestClass): def test_is_server_running(self): '''the server should run under given name and port''' + self.register_auth(self.URL) self.cmd.go(self.URL) + self.cmd.find("CBOX-STATUS") ## other URLs must not be checked, as we do not know, if they are valid @@ -24,11 +46,12 @@ class BuiltinPages(cryptobox.web.testclass.WebInterfaceTestClass): def test_goto_index(self): '''display all devices''' - self.cmd.go(self.URL + "?weblang=en") + self.register_auth(self.URL) + self.cmd.go(self.URL) self.cmd.find("The CryptoBox") self.cmd.go(self.URL + "?weblang=de") self.cmd.find("Die CryptoBox") - self.cmd.go(self.URL + "?weblang=si") + self.cmd.go(self.URL + "?weblang=sl") self.cmd.find("Privatnost v vsako vas") self.cmd.go(self.URL + "?weblang=fr") self.cmd.find("La CryptoBox") diff --git a/src/cryptobox/web/dataset.py b/src/cryptobox/web/dataset.py index 59d8375..8152606 100644 --- a/src/cryptobox/web/dataset.py +++ b/src/cryptobox/web/dataset.py @@ -1,3 +1,23 @@ +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + import os from cryptobox.core.exceptions import * import cryptobox.core.container as cbxContainer @@ -24,7 +44,7 @@ class WebInterfaceDataset(dict): import cryptobox.core.main import cryptobox.web.languages self["Data.Version"] = cryptobox.core.main.VERSION - langs = self.cbox.prefs["WebSettings"]["Languages"] + langs = self.cbox.prefs["WebSettings"]["Languages"][:] langs.sort() for (index, lang) in enumerate(langs): try: @@ -125,7 +145,6 @@ class WebInterfaceDataset(dict): def __setConfigValues(self): self["Settings.TemplateDir"] = os.path.abspath(self.prefs["Locations"]["TemplateDir"]) - self["Settings.LanguageDir"] = os.path.abspath(self.prefs["Locations"]["LangDir"]) self["Settings.DocDir"] = os.path.abspath(self.prefs["Locations"]["DocDir"]) self["Settings.Stylesheet"] = self.prefs["WebSettings"]["Stylesheet"] self["Settings.Language"] = self.prefs["WebSettings"]["Languages"][0] @@ -133,15 +152,3 @@ class WebInterfaceDataset(dict): self["Settings.SettingsDir"] = self.prefs["Locations"]["SettingsDir"] - def __getLanguageName(self, lang): - try: - import neo_cgi, neo_util, neo_cs - except: - raise CBEnvironmentError("couldn't import 'neo_*'! Try 'apt-get install python-clearsilver'.") - hdf_path = os.path.join(self.prefs["Locations"]["LangDir"], lang + ".hdf") - hdf = neo_util.HDF() - hdf.readFile(hdf_path) - return hdf.getValue("Name",lang) - - - diff --git a/src/cryptobox/web/languages.py b/src/cryptobox/web/languages.py index ec70453..e0e857c 100644 --- a/src/cryptobox/web/languages.py +++ b/src/cryptobox/web/languages.py @@ -1,3 +1,24 @@ +#-*- coding: UTF-8 -*- +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + """supply information about existing languages """ diff --git a/src/cryptobox/web/sites.py b/src/cryptobox/web/sites.py index 32c2151..7347b82 100644 --- a/src/cryptobox/web/sites.py +++ b/src/cryptobox/web/sites.py @@ -1,3 +1,23 @@ +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + import cryptobox.core.main import cryptobox.web.dataset import cryptobox.plugins.manage @@ -47,7 +67,7 @@ class WebInterfaceSites: ## store the original http error handler self._cp_on_http_error = self.newHTTPErrorHandler ## set initial language order - self.langOrder = self.cbox.prefs["WebSettings"]["Languages"] + self.langOrder = self.cbox.prefs["WebSettings"]["Languages"][:] def __resetDataset(self): @@ -331,18 +351,22 @@ class WebInterfaceSites: """ ## start with the configured language order langOrder = self.cbox.prefs["WebSettings"]["Languages"][:] + self.cbox.log.debug("updating language preferences (default: %s)" % str(langOrder)) ## put the preferred browser language in front guess = self.__getPreferredBrowserLanguage(langOrder) if guess: langOrder.remove(guess) langOrder.insert(0,guess) + self.cbox.log.debug("raised priority of preferred browser language: %s" % guess) ## is the chosen language (via web interface) valid? - put it in front if value and (value in langOrder) and (not re.search(u'\W',value)): langOrder.remove(value) langOrder.insert(0,value) + self.cbox.log.debug("raised priority of selected language: %s" % value) elif value: self.cbox.log.info("invalid language selected: %s" % value) ## store current language setting + self.cbox.log.debug("current language preference: %s" % str(langOrder)) self.langOrder = langOrder self.dataset["Settings.Language"] = langOrder[0] self.dataset["Settings.LinkAttrs.weblang"] = langOrder[0] @@ -402,7 +426,12 @@ class WebInterfaceSites: def translate_node(node): for (key,value) in node.attrs(): if key == 'LINK': return - node.setValue("",translator.ugettext(node.value())) + try: + node.setValue("",translator.ugettext(node.value())) + except UnicodeEncodeError, errMsg: + self.cbox.log.info("Failed unicode encoding for gettext: %s - %s" % (node.value(),errMsg)) + ## fallback to default encoding + node.setValue("",translator.gettext(node.value())) while hdf_node: translate_node(hdf_node) walk_tree(hdf_node.child()) @@ -417,7 +446,7 @@ class WebInterfaceSites: ## check if the language setting was changed - use cached data if possible try: if self.cachedLanguageData["langOrder"] == self.langOrder: - self.cbox.log.debug("using cached language data") + self.cbox.log.debug("using cached language data: %s" % str(self.langOrder)) return self.cachedLanguageData["hdf"] except AttributeError: pass diff --git a/src/cryptobox/web/testclass.py b/src/cryptobox/web/testclass.py index 1eff640..291220d 100644 --- a/src/cryptobox/web/testclass.py +++ b/src/cryptobox/web/testclass.py @@ -1,3 +1,23 @@ +# +# Copyright 2006 sense.lab e.V. +# +# This file is part of the CryptoBox. +# +# The CryptoBox is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# The CryptoBox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the CryptoBox; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + """ super class of all web interface unittests for the cryptobox @@ -8,6 +28,8 @@ import unittest import twill import cherrypy import cryptobox.web.sites +import os + ## we do the following, for easy surfing ## e.g. use: cbx.go(your_url) @@ -42,7 +64,7 @@ class WebInterfaceTestClass(unittest.TestCase): 'server.threadPool': 1, 'server.environment': 'production', }) - cherrypy.root = cryptobox.web.sites.WebInterfaceSites() + cherrypy.root = cryptobox.web.sites.WebInterfaceSites("cryptobox-unittests.conf") cherrypy.server.start(initOnly=True, serverClass=None) from cherrypy._cpwsgi import wsgiApp @@ -55,6 +77,17 @@ class WebInterfaceTestClass(unittest.TestCase): self.URL = CBX_URL self.cbox = cherrypy.root.cbox self.globals, self.locals = twill.namespaces.get_twill_glocals() + ## search for a usable block device + ## use /dev/ubd? if possible - otherwise /dev/hd? + ## so it will be possible to use these tests inside of an uml + for d in ["ubdb", "loop", "ubda", "udbc", "ubdd", "hdb", "hda", "hdc", "hdd"]: + if os.path.exists("/dev/%s1" % d): + device = d + break + else: + device = "hda" + self.device = device + def tearDown(self): diff --git a/stuff/known_problems b/stuff/known_problems index 0d87995..5c6a830 100644 --- a/stuff/known_problems +++ b/stuff/known_problems @@ -1,4 +1,4 @@ -Bug-Report: twill/other-modules/ClientForm.py: uncomment line 846 ("XHTMLCompatibleFormParser" instead of default parser) - this solves an eternal loop-problem caused by line 958 ("fp.feed(ch)") +Bug-Report: twill/other-packages/ClientForm.py: uncomment line 846 ("XHTMLCompatibleFormParser" instead of default parser) - this solves an eternal loop-problem caused by line 958 ("fp.feed(ch)") Bug-Report: testoob - loading of a TestSuite (as advertised by the commandline help) does not work (due to unittest.py/loadTestsFromModule) diff --git a/templates/footer.cs b/templates/footer.cs index 075dcc3..91a03e1 100644 --- a/templates/footer.cs +++ b/templates/footer.cs @@ -22,7 +22,6 @@ -