Skip to content

/ Zope / gocept svn checkins / Archive / 2009 / 2009-12 / SVN: r30383 - gocept.efs/trunk/src/gocept/efs

[ << ] [ >> ]

[ SVN: r30380 - zopeversions / Wolfgang Schnerring ... ] [ SVN: r30394 - gocept.devtools/tags/0.4 / ... ]

SVN: r30383 - gocept.efs/trunk/src/gocept/efs
Daniel Havlik <dh(at)gocept.com>
2009-12-11 16:20:52 [ FULL ]
Author: nilo
Date: Fri Dec 11 16:20:50 2009
New Revision: 30383

Log:
proper encoding



Modified:
   gocept.efs/trunk/src/gocept/efs/efs.py

Modified: gocept.efs/trunk/src/gocept/efs/efs.py
==============================================================================
--- gocept.efs/trunk/src/gocept/efs/efs.py	(original)
+++ gocept.efs/trunk/src/gocept/efs/efs.py	Fri Dec 11 16:20:50 2009
(at)(at) -32,12 +32,12 (at)(at)
         e_order = writer.start("Order", {'id': efsdata.order_id})
         e_shipping = writer.start("AddressInfo", {'type': 'ship'})
         for key, value in efsdata.shipping_address.items():
-            writer.element(key, value)
+            writer.element(key, unicode(value.decode('utf8')))
         writer.close(e_shipping)
         if efsdata.billing_address:
             e_billing = writer.start("AddressInfo", {'type': 'bill'})
             for key, value in efsdata.billing_address.items():
-                writer.element(key, value)
+                writer.element(key, unicode(value.decode('utf8')))
             writer.close(e_billing)
         writer.element("ShippingMethod", efsdata.shipping_method)
         item_num = 0

SVN: r30384 - gocept.ebaytoefs
Daniel Havlik <dh(at)gocept.com>
2009-12-11 16:22:16 [ FULL ]
Author: nilo
Date: Fri Dec 11 16:22:15 2009
New Revision: 30384

Log:
create module



Added:
   gocept.ebaytoefs/

SVN: r30385 - gocept.ebaytoefs/trunk
Daniel Havlik <dh(at)gocept.com>
2009-12-11 16:22:24 [ FULL ]
Author: nilo
Date: Fri Dec 11 16:22:22 2009
New Revision: 30385

Log:
add trunk



Added:
   gocept.ebaytoefs/trunk/

SVN: r30386 - in gocept.ebaytoefs/trunk: . src src/gocept src/gocept/ebaytoefs
Daniel Havlik <dh(at)gocept.com>
2009-12-11 16:30:02 [ FULL ]
Author: nilo
Date: Fri Dec 11 16:30:00 2009
New Revision: 30386

Log:
boilerplate



Added:
   gocept.ebaytoefs/trunk/CHANGES.txt
   gocept.ebaytoefs/trunk/README.txt
   gocept.ebaytoefs/trunk/setup.py
   gocept.ebaytoefs/trunk/src/
   gocept.ebaytoefs/trunk/src/gocept/
   gocept.ebaytoefs/trunk/src/gocept/__init__.py
   gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/
   gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/README.txt
   gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/__init__.py
   gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py

Added: gocept.ebaytoefs/trunk/CHANGES.txt
==============================================================================
--- (empty file)
+++ gocept.ebaytoefs/trunk/CHANGES.txt	Fri Dec 11 16:30:00 2009
(at)(at) -0,0 +1,8 (at)(at)
+Changes
+=======
+
+
+0.1 (unreleased)
+----------------
+
+- initial release

Added: gocept.ebaytoefs/trunk/README.txt
==============================================================================

Added: gocept.ebaytoefs/trunk/setup.py
==============================================================================
--- (empty file)
+++ gocept.ebaytoefs/trunk/setup.py	Fri Dec 11 16:30:00 2009
(at)(at) -0,0 +1,40 (at)(at)
+from setuptools import setup, find_packages
+import os.path
+
+def read(*rnames):
+    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+version = '0.1'
+
+setup(name='gocept.ebaytoefs',
+      version=version,
+      description="API for the efulfillment service.",
+      long_description = (read('src', 'gocept', 'ebaytoefs', 'README.txt')
+                          + '\n\n' +
+                          read('CHANGES.txt')
+      ),
+      classifiers = [
+            'Development Status :: 4 - Beta',
+            'Environment :: Web Environment',
+            'Intended Audience :: Developers',
+            'License :: OSI Approved :: Zope Public License',
+            'Programming Language :: Python',
+            'Natural Language :: English',
+            'Operating System :: OS Independent',
+            'Topic :: Internet :: WWW/HTTP'],
+      url='http://pypi.python.org/pypi/gocept.ebaytoefs/',
+      keywords='',
+      author='Daniel Havlik',
+      author_email='dh(at)gocept.com',
+      license='ZPL 2.1',
+      packages=find_packages('src'),
+      include_package_data=True,
+      package_dir={'':'src'},
+      zip_safe=False,
+      install_requires=[
+          'gocept.efs',
+      ],
+      entry_points={
+                'console_scripts' : ['ebaytoefs =
gocept.ebaytoefs.ebaytoefs:run']
+		      }
+      )

Added: gocept.ebaytoefs/trunk/src/gocept/__init__.py
==============================================================================
--- (empty file)
+++ gocept.ebaytoefs/trunk/src/gocept/__init__.py	Fri Dec 11 16:30:00 2009
(at)(at) -0,0 +1,10 (at)(at)
+# Copyright (c) 2007 gocept gmbh & co. kg
+# See also LICENSE.txt
+# $Id: __init__.py 6883 2008-10-23 09:00:00Z sweh $
+
+#namespace package boilerplate
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError, e:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)

Added: gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/README.txt
==============================================================================
--- (empty file)
+++ gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/README.txt	Fri Dec 11 16:30:00
2009
(at)(at) -0,0 +1 (at)(at)
+ebaytoefs provides a script to convert ebay csv order exports to efs orders

Added: gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/__init__.py
==============================================================================
--- (empty file)
+++ gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/__init__.py	Fri Dec 11 16:30:00
2009
(at)(at) -0,0 +1 (at)(at)
+#

Added: gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py
==============================================================================
--- (empty file)
+++ gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py	Fri Dec 11
16:30:00 2009
(at)(at) -0,0 +1,2 (at)(at)
+def run():
+    print "foo"

SVN: r30387 - gocept.ebaytoefs/trunk/src/gocept/ebaytoefs
Daniel Havlik <dh(at)gocept.com>
2009-12-11 17:50:21 [ FULL ]
Author: nilo
Date: Fri Dec 11 17:50:20 2009
New Revision: 30387

Log:
implemented conversion



Modified:
   gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py

Modified: gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py
==============================================================================
--- gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py	(original)
+++ gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py	Fri Dec 11
17:50:20 2009
(at)(at) -1,2 +1,46 (at)(at)
+import optparse
+import gocept.efs.efs
+import gocept.efs.interfaces
+import sys
+import csv
+import zope.interface
+
+
+class EfsData(object):
+    zope.interface.implements(gocept.efs.interfaces.IEfsData)
+
+    def __init__(self, datadict):
+        self.shipping_address = {
+            'Name': datadict.get('Buyer Fullname'),
+            'Company': '',
+            'Address1': datadict.get('Buyer Address 1'),
+            'Address2': datadict.get('Buyer Address 2'),
+            'City': datadict.get('Buyer City'),
+            'State': datadict.get('Buyer State'),
+            'Country': datadict.get('Buyer Country'),
+            'Zip': datadict.get('Buyer Zip'),
+            'Phone': datadict.get('Buyer Phone Number'),
+            'Email': datadict.get('Buyer Email'),}
+        self.billing_address = {}
+        self.shipping_method = '' #XXX
+        self.order_id = 'ebay_%s' % datadict.get('Sales Record Number')
+        self.order = [{'ProductId': '', 'Quantity': datadict.get('Quantity')}]
+
 def run():
-    print "foo"
+    usage = "usage: %prog [options]"
+    description="Converts an ebay csv file to an efs xml order file."
+    parser = optparse.OptionParser(usage=usage, description=description)
+    parser.add_option("-f", "--file", dest="filename",
+            help="Ebay csv-File to convert.")
+    parser.add_option("-t", "--target-path", dest="target_path",
+            help="Target path where the efs order is saved.")
+    parser.add_option("-m", "--merchant-name", dest="merchant_name",
+            help="The merchant name as used by efs.")
+    parser.add_option("-i", "--merchant-id", dest="merchant_id",
+            help="The merchant id as used by efs.")
+    options, args = parser.parse_args()
+    dicts = list(csv.DictReader(open(options.filename), delimiter=','))
+    efs_api = gocept.efs.efs.Efs(options.merchant_id, options.merchant_name, 
+            options.target_path)
+    for datadict in dicts:
+        efs_api.create_order(EfsData(datadict))

SVN: r30388 - gocept.ebaytoefs/trunk/src/gocept/ebaytoefs
Daniel Havlik <dh(at)gocept.com>
2009-12-11 17:51:40 [ FULL ]
Author: nilo
Date: Fri Dec 11 17:51:39 2009
New Revision: 30388

Log:
add some XXX 



Modified:
   gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py

Modified: gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py
==============================================================================
--- gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py	(original)
+++ gocept.ebaytoefs/trunk/src/gocept/ebaytoefs/ebaytoefs.py	Fri Dec 11
17:51:39 2009
(at)(at) -5,7 +5,6 (at)(at)
 import csv
 import zope.interface
 
-
 class EfsData(object):
     zope.interface.implements(gocept.efs.interfaces.IEfsData)
 
(at)(at) -17,14 +16,14 (at)(at)
             'Address2': datadict.get('Buyer Address 2'),
             'City': datadict.get('Buyer City'),
             'State': datadict.get('Buyer State'),
-            'Country': datadict.get('Buyer Country'),
+            'Country': datadict.get('Buyer Country'), #XXX convert to ISO
             'Zip': datadict.get('Buyer Zip'),
             'Phone': datadict.get('Buyer Phone Number'),
             'Email': datadict.get('Buyer Email'),}
         self.billing_address = {}
-        self.shipping_method = '' #XXX
+        self.shipping_method = '' #XXX need codes understood by efs
         self.order_id = 'ebay_%s' % datadict.get('Sales Record Number')
-        self.order = [{'ProductId': '', 'Quantity': datadict.get('Quantity')}]
+        self.order = [{'ProductId': '', 'Quantity': datadict.get('Quantity')}]
#XXX need real product ids
 
 def run():
     usage = "usage: %prog [options]"

SVN: r30389 - webmailer/gocept.webmail/trunk/gocept/webmail/browser
Thomas Lotze <tl(at)gocept.com>
2009-12-15 15:27:34 [ FULL ]
Author: thomas
Date: Tue Dec 15 15:27:32 2009
New Revision: 30389

Log:
include test stuff only if gocept.selenium is available as the test modules
will import it


Modified:
   webmailer/gocept.webmail/trunk/gocept/webmail/browser/configure.zcml

Modified: webmailer/gocept.webmail/trunk/gocept/webmail/browser/configure.zcml
==============================================================================
---
webmailer/gocept.webmail/trunk/gocept/webmail/browser/configure.zcml	(original)
+++ webmailer/gocept.webmail/trunk/gocept/webmail/browser/configure.zcml	Tue
Dec 15 15:27:32 2009
(at)(at) -1,5 +1,6 (at)(at)
 <configure xmlns="http://namespaces.zope.org/zope"
-  xmlns:browser="http://namespaces.zope.org/browser">
+           xmlns:browser="http://namespaces.zope.org/browser"
+           xmlns:zcml="http://namespaces.zope.org/zcml">
 
   <browser:page
      for="..interfaces.IWebmailer"
(at)(at) -59,6 +60,7 (at)(at)
     permission="zope2.View"
     />
 
-  <include package=".tests" />
+  <include package=".tests"
+           zcml:condition="installed gocept.selenium" />
 
 </configure>

SVN: r30390 - gocept.devtools/trunk/gocept/devtools
Christian Theune <ct(at)gocept.com>
2009-12-15 16:32:33 [ FULL ]
Author: ctheune
Date: Tue Dec 15 16:32:31 2009
New Revision: 30390

Log:
Get the semantics for owner changes right.

Now a copyright fix of a file means: ensure that *this* owner is attributed in
*this* year. If nothing else it causes at least a normalization of existing
data.



Modified:
   gocept.devtools/trunk/gocept/devtools/copyright.py
   gocept.devtools/trunk/gocept/devtools/copyright.txt

Modified: gocept.devtools/trunk/gocept/devtools/copyright.py
==============================================================================
--- gocept.devtools/trunk/gocept/devtools/copyright.py	(original)
+++ gocept.devtools/trunk/gocept/devtools/copyright.py	Tue Dec 15 16:32:31 2009
(at)(at) -10,95 +10,104 (at)(at)
 import re
 import sys
 
+TEMPLATE_PATTERN = re.compile(
+    '^(?P<lead>.*)Copyright \\(c\\) '
+    '(?P<periods>[0-9\-, ]+) (?P<owner>.*)$')
 
-def fix_file(file, owner, year, append):
+
+def fix_file(file, owner, year):
     output = StringIO.StringIO()
+    line_set = []
     for number, line in enumerate(file):
-        if line.endswith('\n'):
-            line = line[:-1]
-            trail = '\n'
-        else:
-            trail = ''
-        if append:
-            line, has_copyright = fix_line(line)
-            if has_copyright:
-                line = line + '\n' + fix_line(
-                    line, owner, year, replace_years=True)[0]
+        if has_copyright(line):
+            # First append copyright lines to the set
+            line_set.append(line)
+        elif line_set:
+            # Then, if we have found lines and the block is done,
+            # perform the update.
+            for fixed in fix_block(line_set, year, owner):
+                output.write(fixed)
+            line_set = []
+            output.write(line)
         else:
-            line, _ = fix_line(line, owner, year)
-        line = line + trail
-        output.write(line)
+            # Just a regular line.
+            output.write(line)
     return output
 
 
-def fix_line(line, owner=None, year=None, replace_years=False):
-    TEMPLATE_PATTERN = re.compile(
-        '^(?P<lead>.*)Copyright \\(c\\) '
-        '(?P<periods>[0-9\-, ]+) (?P<owner>.*)$')
-    m = TEMPLATE_PATTERN.match(line)
-    # This doesn't look like a copyright line at all. Just leave as is.
-    if m is None:
-        return line, False
-
-    lead = m.group('lead')
-    if lead.strip() == '#':
-        # Python copyright line
-        pass
-    elif lead.strip() == '':
-        # C copyright line, embedded in multi-line comment
-        pass
-    else:
-        raise ValueError('Invalid lead for copyright line', line)
-
-    years = set()
-    periods = m.group('periods').split(',')
-
-    for period in periods:
-        period = period.replace(' ', '')
-        if '-' not in period:
-            # A single year period
-            years.add(int(period))
-            continue
-        if period.count('-') > 1:
-            # Something is wrong, stop processing.
-            return line, False
-        # A multi-year period
-        first, last = period.split('-')
-        years.update(range(int(first), int(last) + 1))
-
-    if year is not None:
-        years.add(year)
-    years = sorted(years)
-
-    if replace_years:
-        if year is None:
-            year = years[-1]
-        years = [year]
-
-    # Compress adjacent years into periods
-    periods = []
-    period = []
-    for year in years:
-        if period and year-1 not in period:
-            periods.append(period)
-            period = []
-        period.append(year)
-    periods.append(period)
+def has_copyright(line):
+    return TEMPLATE_PATTERN.match(line) is not None
 
-    signature = []
-    for period in periods:
-        if len(period) > 1:
-            signature.append('%s-%s' % (min(period), max(period)))
-        else:
-            signature.append(str(period[0]))
 
-    if owner is None:
+def fix_block(lines, new_year, new_owner):
+    global_lead = None
+    # Ensure consistent leads in all copyright statements
+    for line in lines:
+        m = TEMPLATE_PATTERN.match(line)
+        assert m is not None
+        lead = m.group('lead')
+        if lead.strip() == '#':
+            # Python copyright line
+            pass
+        elif lead.strip() == '':
+            # C copyright line, embedded in multi-line comment
+            pass
+        else:
+            raise ValueError('Invalid lead for copyright line', line)
+        if global_lead is not None and lead != global_lead:
+            raise ValueError('Inconsistent multi-line leads: %r vs %r'
+                             (global_lead, lead))
+        elif global_lead is None:
+            global_lead = lead
+
+    updated = False
+    for line in lines:
+        m = TEMPLATE_PATTERN.match(line)
         owner = m.group('owner')
+        if owner == new_owner:
+            # Found an existing entry, update.
+            years = set()
+            periods = m.group('periods').split(',')
+
+            for period in periods:
+                period = period.replace(' ', '')
+                if '-' not in period:
+                    # A single year period
+                    years.add(int(period))
+                    continue
+                if period.count('-') > 1:
+                    # Something is wrong, stop processing.
+                    raise ValueError('Invalid time period %r' % period)
+                # A multi-year period
+                first, last = period.split('-')
+                years.update(range(int(first), int(last) + 1))
+
+            years.add(new_year)
+            years = sorted(years)
+
+            # Compress adjacent years into periods
+            periods = []
+            period = []
+            for year in years:
+                if period and year-1 not in period:
+                    periods.append(period)
+                    period = []
+                period.append(year)
+            periods.append(period)
 
-    lead = m.group('lead')
-    signature = ','.join(str(y) for y in signature)
-    line = '%sCopyright (c) %s %s' % (lead, signature, owner)
-    return line, True
+            signature = []
+            for period in periods:
+                if len(period) > 1:
+                    signature.append('%s-%s' % (min(period), max(period)))
+                else:
+                    signature.append(str(period[0]))
+
+            signature = ','.join(str(y) for y in signature)
+            line = '%sCopyright (c) %s %s\n' % (global_lead, signature, owner)
+            updated = True
+        yield line
+    if not updated:
+        yield '%sCopyright (c) %s %s\n' % (global_lead, new_year, new_owner)
 
 
 def visit((owner, year, append), dirname, names):
(at)(at) -120,8 +129,9 (at)(at)
 
 
 def main():
-    description = ('Update the copyright header of all Python files in a '
-                   'given directory to include the current year.')
+    description = ('Update the copyright header of all (Python) files in a '
+                   'given directory to include a given year and copyright '
+                   'holder.')
     parser = optparse.OptionParser(description=description)
     parser.add_option(
         '-d', '--directory', default='.',

Modified: gocept.devtools/trunk/gocept/devtools/copyright.txt
==============================================================================
--- gocept.devtools/trunk/gocept/devtools/copyright.txt	(original)
+++ gocept.devtools/trunk/gocept/devtools/copyright.txt	Tue Dec 15 16:32:31
2009
(at)(at) -7,76 +7,88 (at)(at)
 - include a specific year in the copyright
 - specify the owner of the copyright
 
-Individual lines can be updated using the `fix_line` function:
+Copyright lines can be updated using the `fix_block` function:
+
+>>> from gocept.devtools.copyright import fix_block
+>>> def do_fix_block(*args, **kw):
+...     print ''.join(fix_block(*args, **kw))
 
->>> from gocept.devtools.copyright import fix_line
 
 Normalizing the list of years
 -----------------------------
 
 If no parameters are given, only normalization of years is applied:
 
->>> print fix_line('# Copyright (c) 2001 FooCorp')[0]
+>>> do_fix_block(['# Copyright (c) 2001 FooCorp\n'], 2001, 'FooCorp')
 # Copyright (c) 2001 FooCorp
+<BLANKLINE>
 
->>> print fix_line('# Copyright (c) 2001,2002,2003 FooCorp')[0]
+>>> do_fix_block(['# Copyright (c) 2001,2002,2003 FooCorp\n'], 2001,
'FooCorp')
 # Copyright (c) 2001-2003 FooCorp
+<BLANKLINE>
 
->>> print fix_line('# Copyright (c) 2001,2002,2003,2005 FooCorp')[0]
+>>> do_fix_block(['# Copyright (c) 2001,2002,2003,2005 FooCorp\n'],
+...              2001, 'FooCorp')
 # Copyright (c) 2001-2003,2005 FooCorp
+<BLANKLINE>
 
->>> print fix_line('# Copyright (c) 2001 - 2002, 2003, 2005
FooCorp')[0]
+>>> do_fix_block(['# Copyright (c) 2001 - 2002, 2003, 2005
FooCorp\n'],
+...              2001, 'FooCorp')
 # Copyright (c) 2001-2003,2005 FooCorp
+<BLANKLINE>
 
-Fixing years
-------------
+Fixing years for existing owners
+--------------------------------
 
->>> print fix_line('# Copyright (c) 2001 FooCorp', year=2008)[0]
+>>> do_fix_block(['# Copyright (c) 2001 FooCorp\n'], 2008, 'FooCorp')
 # Copyright (c) 2001,2008 FooCorp
+<BLANKLINE>
 
->>> print fix_line('# Copyright (c) 2007 FooCorp', year=2008)[0]
+>>> do_fix_block(['# Copyright (c) 2007 FooCorp\n'], 2008, 'FooCorp')
 # Copyright (c) 2007-2008 FooCorp
+<BLANKLINE>
 
->>> print fix_line('# Copyright (c) 2001-2003 FooCorp', year=2008)[0]
+>>> do_fix_block(['# Copyright (c) 2001-2003 FooCorp\n'], 2008,
'FooCorp')
 # Copyright (c) 2001-2003,2008 FooCorp
+<BLANKLINE>
 
->>> print fix_line('# Copyright (c) 2001,2003 FooCorp', year=2008)[0]
+>>> do_fix_block(['# Copyright (c) 2001,2003 FooCorp\n'], 2008,
'FooCorp')
 # Copyright (c) 2001,2003,2008 FooCorp
+<BLANKLINE>
 
->>> print fix_line('# Copyright (c) 2001,2003-2005,2007 FooCorp',
year=2008)[0]
+>>> do_fix_block(['# Copyright (c) 2001,2003-2005,2007 FooCorp\n'],
2008, 'FooCorp')
 # Copyright (c) 2001,2003-2005,2007-2008 FooCorp
+<BLANKLINE>
 
->>> print fix_line('# Copyright (c) 2008 FooCorp', year=2008)[0]
+>>> do_fix_block(['# Copyright (c) 2008 FooCorp\n'], 2008, 'FooCorp')
 # Copyright (c) 2008 FooCorp
+<BLANKLINE>
 
 Lines with errors are not changed:
 
->>> print fix_line('# Copyright (c) 2008--2009 FooCorp')[0]
-# Copyright (c) 2008--2009 FooCorp
+>>> do_fix_block(['# Copyright (c) 2008--2009 FooCorp\n'], 2010,
'FooCorp')
+Traceback (most recent call last):
+ValueError: Invalid time period '2008--2009'
 
 
-Fixing owners
--------------
+Adding new owners
+-----------------
 
 The ownership of the copyright can be changed to another holder by specifying
 the `owner`
 
->>> print fix_line('# Copyright (c) 2008 FooCorp', owner='Bar
Foundation')[0]
+>>> do_fix_block(['# Copyright (c) 2008 FooCorp\n'], 2008, 'Bar
Foundation')
+# Copyright (c) 2008 FooCorp
 # Copyright (c) 2008 Bar Foundation
-
+<BLANKLINE>
 
 Combined fixing
 ---------------
 
->>> print fix_line('# Copyright (c) 2008 FooCorp', year=2009,
owner='Bar Foundation')[0]
-# Copyright (c) 2008-2009 Bar Foundation
-
-
-Replacing existing years
-------------------------
-
->>> print fix_line('# Copyright (c) 2008 FooCorp', year=2009,
replace_years=True)[0]
-# Copyright (c) 2009 FooCorp
+>>> do_fix_block(['# Copyright (c) 2008 FooCorp\n'], 2009, 'Bar
Foundation')
+# Copyright (c) 2008 FooCorp
+# Copyright (c) 2009 Bar Foundation
+<BLANKLINE>
 
 
 Leading characters
(at)(at) -88,18 +100,20 (at)(at)
 - Python
 - C
 
->>> print fix_line('# Copyright (c) 2008 FooCorp')[0]
+>>> do_fix_block(['# Copyright (c) 2008 FooCorp\n'], 2008, 'FooCorp')
 # Copyright (c) 2008 FooCorp
+<BLANKLINE>
 
->>> print fix_line('    Copyright (c) 2008 FooCorp')[0]
+>>> do_fix_block(['    Copyright (c) 2008 FooCorp\n'], 2008,
'FooCorp')
     Copyright (c) 2008 FooCorp
-
->>> print fix_line('  #    Copyright (c) 2008 FooCorp')[0]
+<BLANKLINE>
+>>> do_fix_block(['  #    Copyright (c) 2008 FooCorp\n'], 2008,
'FooCorp')
   #    Copyright (c) 2008 FooCorp
+<BLANKLINE>
 
->>> print fix_line('/*    Copyright (c) 2008 FooCorp')[0]
+>>> do_fix_block(['/*    Copyright (c) 2008 FooCorp\n'], 2008,
'FooCorp')
 Traceback (most recent call last):
-ValueError: ('Invalid lead for copyright line', '/*    Copyright (c) 2008
FooCorp')
+ValueError: ('Invalid lead for copyright line', '/*    Copyright (c) 2008
FooCorp\n')
 
 
 Keeping existing lines intact, appending new data in whole files
(at)(at) -109,13 +123,13 (at)(at)
 >>> from StringIO import StringIO
 >>> print fix_file(StringIO("""\
 ... # Copyright (c) 2008 FooCorp
-... Gnarr"""), year=2009, owner='Bar Foundation', append=True).getvalue()
+... Gnarr"""), year=2009, owner='Bar Foundation').getvalue()
 # Copyright (c) 2008 FooCorp
 # Copyright (c) 2009 Bar Foundation
 Gnarr
 >>> print fix_file(StringIO("""\
 ... # Copyright (c) 2008 FooCorp
-... Gnarr"""), year=None, owner='Bar Foundation', append=True).getvalue()
+... Gnarr"""), year=2008, owner='Bar Foundation').getvalue()
 # Copyright (c) 2008 FooCorp
 # Copyright (c) 2008 Bar Foundation
 Gnarr

SVN: r30391 - gocept.devtools/trunk/gocept/devtools
Christian Theune <ct(at)gocept.com>
2009-12-17 10:15:58 [ FULL ]
Author: ctheune
Date: Thu Dec 17 10:15:57 2009
New Revision: 30391

Log:
Remove superfluous append option.



Modified:
   gocept.devtools/trunk/gocept/devtools/copyright.py

Modified: gocept.devtools/trunk/gocept/devtools/copyright.py
==============================================================================
--- gocept.devtools/trunk/gocept/devtools/copyright.py	(original)
+++ gocept.devtools/trunk/gocept/devtools/copyright.py	Thu Dec 17 10:15:57 2009
(at)(at) -110,7 +110,7 (at)(at)
         yield '%sCopyright (c) %s %s\n' % (global_lead, new_year, new_owner)
 
 
-def visit((owner, year, append), dirname, names):
+def visit((owner, year), dirname, names):
     for name in list(names):
         if name.startswith('.'):
             # Avoid directories like .svn
(at)(at) -124,7 +124,7 (at)(at)
         if os.path.isfile(os.path.join(dirname, name)):
             path = os.path.join(dirname, name)
             file = open(path, 'r')
-            fixed = fix_file(file, owner, year, append)
+            fixed = fix_file(file, owner, year)
             open(path, 'w').write(fixed.getvalue())
 
 
(at)(at) -136,15 +136,12 (at)(at)
     parser.add_option(
         '-d', '--directory', default='.',
         help='Directory to search for files to update. Default: %default')
-    parser.add_option('-a', '--append', default=False, action='store_true',
-        help='Only normalize existing copyright lines, append new lines'
-             'for new data.')
     parser.add_option('-y', '--year', default=None, type='int',
-                      help='Additional year to include in the copyright line')
+                      help='Year to include in the copyright line')
     parser.add_option('-o', '--owner', default=None,
-                      help='Owner identifier to replace with.')
+                      help='Owner identifier to set.')
 
     options, args = parser.parse_args()
 
     os.path.walk(options.directory, visit,
-                 (options.owner, options.year, options.append))
+                 (options.owner, options.year))

SVN: r30392 - gocept.devtools/trunk
Christian Theune <ct(at)gocept.com>
2009-12-17 10:16:36 [ FULL ]
Author: ctheune
Date: Thu Dec 17 10:16:35 2009
New Revision: 30392

Log:
Update history.



Modified:
   gocept.devtools/trunk/HISTORY.txt

Modified: gocept.devtools/trunk/HISTORY.txt
==============================================================================
--- gocept.devtools/trunk/HISTORY.txt	(original)
+++ gocept.devtools/trunk/HISTORY.txt	Thu Dec 17 10:16:35 2009
(at)(at) -4,7 +4,8 (at)(at)
 0.4 (unreleased)
 ----------------
 [...]

SVN: r30393 - gocept.devtools/trunk
Christian Theune <ct(at)gocept.com>
2009-12-17 10:16:41 [ FULL ]
Author: ctheune
Date: Thu Dec 17 10:16:40 2009
New Revision: 30393

Log:
Preparing release 0.4


Modified:
   gocept.devtools/trunk/HISTORY.txt
   gocept.devtools/trunk/setup.py

Modified: gocept.devtools/trunk/HISTORY.txt
==============================================================================
--- gocept.devtools/trunk/HISTORY.txt	(original)
+++ gocept.devtools/trunk/HISTORY.txt	Thu Dec 17 10:16:40 2009
(at)(at) -1,7 +1,7 (at)(at)
 HISTORY
 =======
 
-0.4 (unreleased)
+0.4 (2009-12-17)
 ----------------
 
 - Remove append option and always make adding owners and years work on a block

Modified: gocept.devtools/trunk/setup.py
==============================================================================
--- gocept.devtools/trunk/setup.py	(original)
+++ gocept.devtools/trunk/setup.py	Thu Dec 17 10:16:40 2009
(at)(at) -7,7 +7,7 (at)(at)
 
 setup(
     name='gocept.devtools',
-    version = '0.4dev',
+    version = '0.4',
     author='Christian Theune',
     author_email='ct(at)gocept.com',
     description='Small utilities for managing code.',

SVN: r30400 - in gocept.pagelet/trunk: . src/gocept/pagelet
Michael Howitz <mh(at)gocept.com>
2009-12-27 13:42:10 [ FULL ]
Author: mac
Date: Sun Dec 27 13:42:08 2009
New Revision: 30400

Log:
Using ``zope.browserpage`` and ``zope.browsermenu`` instead of
``zope.app.publisher``.




Modified:
   gocept.pagelet/trunk/CHANGES.txt
   gocept.pagelet/trunk/setup.py
   gocept.pagelet/trunk/src/gocept/pagelet/zcml.py

Modified: gocept.pagelet/trunk/CHANGES.txt
==============================================================================
--- gocept.pagelet/trunk/CHANGES.txt	(original)
+++ gocept.pagelet/trunk/CHANGES.txt	Sun Dec 27 13:42:08 2009
(at)(at) -5,7 +5,8 (at)(at)
 0.3 (unreleased)
 ================
 [...]

MailBoxer