--- a/common/i18n.py Fri Sep 18 11:24:37 2009 +0200
+++ b/common/i18n.py Fri Sep 18 12:21:49 2009 +0200
@@ -9,6 +9,7 @@
import re
import os
+import sys
from os.path import join, basename, splitext, exists
from glob import glob
--- a/common/migration.py Fri Sep 18 11:24:37 2009 +0200
+++ b/common/migration.py Fri Sep 18 12:21:49 2009 +0200
@@ -341,7 +341,7 @@
configfile = self.config.main_config_file()
if self._option_changes:
read_old_config(self.config, self._option_changes, configfile)
- _, newconfig = tempfile.mkstemp()
+ fd, newconfig = tempfile.mkstemp()
for optdescr in self._option_changes:
if optdescr[0] == 'added':
optdict = self.config.get_option_def(optdescr[1])
@@ -349,6 +349,7 @@
self.config.input_option(optdescr[1], optdict)
self.config.generate_config(open(newconfig, 'w'))
show_diffs(configfile, newconfig)
+ os.close(fd)
if exists(newconfig):
os.unlink(newconfig)
--- a/common/test/unittest_mail.py Fri Sep 18 11:24:37 2009 +0200
+++ b/common/test/unittest_mail.py Fri Sep 18 12:21:49 2009 +0200
@@ -8,7 +8,7 @@
"""
import os
-import pwd
+import sys
from logilab.common.testlib import unittest_main
from logilab.common.umessage import message_from_string
@@ -22,7 +22,11 @@
(man 3 getlogin)
Another solution would be to use $LOGNAME, $USER or $USERNAME
"""
- return pwd.getpwuid(os.getuid())[0]
+ if sys.platform != 'win32':
+ import pwd
+ return pwd.getpwuid(os.getuid())[0]
+ else:
+ return os.environ.get('USERNAME')
class EmailTC(EnvBasedTC):
--- a/devtools/__init__.py Fri Sep 18 11:24:37 2009 +0200
+++ b/devtools/__init__.py Fri Sep 18 12:21:49 2009 +0200
@@ -130,7 +130,7 @@
self.set_option('sender-addr', 'cubicweb-test@logilab.fr')
try:
send_to = '%s@logilab.fr' % os.getlogin()
- except OSError:
+ except (OSError, AttributeError):
send_to = '%s@logilab.fr' % (os.environ.get('USER')
or os.environ.get('USERNAME')
or os.environ.get('LOGNAME'))
--- a/devtools/htmlparser.py Fri Sep 18 11:24:37 2009 +0200
+++ b/devtools/htmlparser.py Fri Sep 18 12:21:49 2009 +0200
@@ -36,7 +36,11 @@
class DTDValidator(Validator):
def __init__(self):
Validator.__init__(self)
- self.parser = etree.XMLParser(dtd_validation=True)
+ # XXX understand what's happening under windows
+ validate = True
+ if sys.platform == 'win32':
+ validate = False
+ self.parser = etree.XMLParser(dtd_validation=validate)
def preprocess_data(self, data):
"""used to fix potential blockquote mess generated by docutils"""
--- a/doc/book/en/admin/setup.rst Fri Sep 18 11:24:37 2009 +0200
+++ b/doc/book/en/admin/setup.rst Fri Sep 18 12:21:49 2009 +0200
@@ -122,11 +122,28 @@
Please be careful to select the right python (2.5) and postgres (8.4)
versions.
+Pyro enable remote access to cubicweb repository instances. Get it
+there::
+
+ http://sourceforge.net/projects/pyro/files/
+
+To access LDAP/Active directory directories, we need the python-ldap
+package. Windows binaries are available from::
+
+ http://www.osuch.org/python-ldap
+
+Check out the latest release.
+
Having graphviz will allow schema drawings, which is quite recommended
(albeit not mandatory). You should get an msi installer there::
http://www.graphviz.org/Download_windows.php
+Simplejson will be provided within the forest, but a win32 compiled
+version will run much faster::
+
+ http://www.osuch.org/python-simplejson%3Awin32
+
Tools
_____
--- a/entities/test/unittest_base.py Fri Sep 18 11:24:37 2009 +0200
+++ b/entities/test/unittest_base.py Fri Sep 18 12:21:49 2009 +0200
@@ -136,6 +136,7 @@
self.vreg.register_appobject_class(Foo)
eclass = self.select_eclass('SubDivision')
self.failUnless(eclass.__autogenerated__)
+ self.failIf(eclass is Foo)
if etype == 'SubDivision':
self.assertEquals(eclass.__bases__, (Foo,))
else:
--- a/ext/xhtml2fo.py Fri Sep 18 11:24:37 2009 +0200
+++ b/ext/xhtml2fo.py Fri Sep 18 12:21:49 2009 +0200
@@ -1,6 +1,3 @@
-from cubicweb.utils import can_do_pdf_conversion
-assert can_do_pdf_conversion()
-
from xml.etree.ElementTree import QName, fromstring
from pysixt.standard.xhtml_xslfo.transformer import XHTML2FOTransformer
from pysixt.utils.xslfo.standard import cm
--- a/md5crypt.py Fri Sep 18 11:24:37 2009 +0200
+++ b/md5crypt.py Fri Sep 18 12:21:49 2009 +0200
@@ -1,10 +1,8 @@
#########################################################
"""
-
+XXX clarify this header
:organization: Logilab
-:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
-:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
"""
# md5crypt.py
#
@@ -58,8 +56,9 @@
v = v >> 6
return ret
-
def crypt(pw, salt, magic=None):
+ if isinstance(pw, unicode):
+ pw = pw.encode('utf-8')
if magic is None:
magic = MAGIC
# Take care of the magic string if present
--- a/server/serverctl.py Fri Sep 18 11:24:37 2009 +0200
+++ b/server/serverctl.py Fri Sep 18 12:21:49 2009 +0200
@@ -677,7 +677,8 @@
import tempfile
srcappid = pop_arg(args, 1, msg='No source instance specified !')
destappid = pop_arg(args, msg='No destination instance specified !')
- output = tempfile.mkstemp()[1]
+ fd, output = tempfile.mkstemp()
+ os.close(fd)
if ':' in srcappid:
host, srcappid = srcappid.split(':')
_remote_dump(host, srcappid, output, self.config.sudo)
--- a/server/test/unittest_migractions.py Fri Sep 18 11:24:37 2009 +0200
+++ b/server/test/unittest_migractions.py Fri Sep 18 12:21:49 2009 +0200
@@ -383,7 +383,9 @@
self.mh.cmd_remove_cube('email', removedeps=True)
# file was there because it's an email dependancy, should have been removed
self.failIf('email' in self.config.cubes())
+ self.failIf(self.config.cube_dir('email') in self.config.cubes_path())
self.failIf('file' in self.config.cubes())
+ self.failIf(self.config.cube_dir('file') in self.config.cubes_path())
for ertype in ('Email', 'EmailThread', 'EmailPart', 'File', 'Image',
'sender', 'in_thread', 'reply_to', 'data_format'):
self.failIf(ertype in schema, ertype)
@@ -404,7 +406,9 @@
finally:
self.mh.cmd_add_cube('email')
self.failUnless('email' in self.config.cubes())
+ self.failUnless(self.config.cube_dir('email') in self.config.cubes_path())
self.failUnless('file' in self.config.cubes())
+ self.failUnless(self.config.cube_dir('file') in self.config.cubes_path())
for ertype in ('Email', 'EmailThread', 'EmailPart', 'File', 'Image',
'sender', 'in_thread', 'reply_to', 'data_format'):
self.failUnless(ertype in schema, ertype)
--- a/test/unittest_utils.py Fri Sep 18 11:24:37 2009 +0200
+++ b/test/unittest_utils.py Fri Sep 18 12:21:49 2009 +0200
@@ -21,12 +21,12 @@
self.assertNotEquals(make_uid('xyz'), make_uid('xyz'))
def test_2(self):
- d = {}
+ d = set()
while len(d)<10000:
uid = make_uid('xyz')
- if d.has_key(uid):
+ if uid in d:
self.fail(len(d))
- d[uid] = 1
+ d.add(uid)
class UStringIOTC(TestCase):
--- a/utils.py Fri Sep 18 11:24:37 2009 +0200
+++ b/utils.py Fri Sep 18 12:21:49 2009 +0200
@@ -10,13 +10,14 @@
from logilab.mtconverter import xml_escape
import locale
+import sys
+import decimal
+import datetime as pydatetime
from md5 import md5
-import datetime as pydatetime
from datetime import datetime, timedelta, date
from time import time, mktime
from random import randint, seed
from calendar import monthrange
-import decimal
import simplejson
@@ -107,11 +108,17 @@
encoding = locale.getpreferredencoding(do_setlocale=False) or 'UTF-8'
return unicode(date.strftime(str(fmt)), encoding)
-def make_uid(key):
- """forge a unique identifier"""
- msg = str(key) + "%.10f" % time() + str(randint(0, 1000000))
- return md5(msg).hexdigest()
+if sys.version_info[:2] < (2, 5):
+ def make_uid(key):
+ """forge a unique identifier
+ not that unique on win32"""
+ msg = str(key) + "%.10f" % time() + str(randint(0, 1000000))
+ return md5(msg).hexdigest()
+else:
+ from uuid import uuid4
+ def make_uid(key):
+ return str(key) + str(uuid4())
def dump_class(cls, clsname):
"""create copy of a class by creating an empty class inheriting
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/unittest_uicfg.py Fri Sep 18 12:21:49 2009 +0200
@@ -0,0 +1,14 @@
+from cubicweb.devtools.apptest import EnvBasedTC
+from cubicweb.web import uicfg
+
+class UICFGTC(EnvBasedTC):
+
+ def test_autoform_section_inlined(self):
+ self.assertEquals(uicfg.autoform_is_inlined.etype_get('CWUser', 'use_email', 'subject', 'EmailAddress'),
+ True)
+ self.assertEquals(uicfg.autoform_section.etype_get('CWUser', 'use_email', 'subject', 'EmailAddress'),
+ 'generated')
+
+if __name__ == '__main__':
+ from logilab.common.testlib import unittest_main
+ unittest_main()
--- a/web/views/__init__.py Fri Sep 18 11:24:37 2009 +0200
+++ b/web/views/__init__.py Fri Sep 18 12:21:49 2009 +0200
@@ -111,13 +111,8 @@
def cell_call(self, row=0, col=0):
self.row, self.col = row, col # in case one needs it
- _, tmpfile = tempfile.mkstemp('.png')
- try:
- self._generate(tmpfile)
- self.w(open(tmpfile, 'rb').read())
- finally:
- try:
- os.unlink(tmpfile)
- except Exception, ex:
- if sys.platform != 'win32':
- self.warning("can't delete %s : %s" % (tmpfile, ex))
+ fd, tmpfile = tempfile.mkstemp('.png')
+ os.close(fd)
+ self._generate(tmpfile)
+ self.w(open(tmpfile, 'rb').read())
+ os.unlink(tmpfile)
--- a/web/views/autoform.py Fri Sep 18 11:24:37 2009 +0200
+++ b/web/views/autoform.py Fri Sep 18 12:21:49 2009 +0200
@@ -355,7 +355,6 @@
uicfg.autoform_section.tag_object_of(('*', 'created_by', 'CWUser'), 'generated')
uicfg.autoform_section.tag_object_of(('*', 'bookmarked_by', 'CWUser'), 'metadata')
uicfg.autoform_section.tag_attribute(('Bookmark', 'path'), 'primary')
-uicfg.autoform_section.tag_subject_of(('*', 'use_email', '*'), 'generated') # inlined actually
uicfg.autoform_section.tag_subject_of(('*', 'primary_email', '*'), 'generic')
uicfg.autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'),