← Back to team overview

oerppy-hackers team mailing list archive

[Branch ~oerppy-hackers/oerppy/trunk] Rev 29: * Added a README for the Canonical addon.

 

------------------------------------------------------------
revno: 29
committer: duncan@xxxxxxxxxx
branch nick: trunk
timestamp: Thu 2011-06-02 09:59:48 -0600
message:
  * Added a README for the Canonical addon.
  * Moved the general-purpose Export scripting class into oerppy.scripting.base.
added:
  oerppy/addons/canonical/README
modified:
  bin/export_month_timesheets
  oerppy/addons/canonical/scripting/export.py
  oerppy/scripting/__init__.py
  oerppy/scripting/base.py


--
lp:oerppy
https://code.launchpad.net/~oerppy-hackers/oerppy/trunk

Your team oerppy Hackers is subscribed to branch lp:oerppy.
To unsubscribe from this branch go to https://code.launchpad.net/~oerppy-hackers/oerppy/trunk/+edit-subscription
=== modified file 'bin/export_month_timesheets'
--- bin/export_month_timesheets	2011-06-02 15:49:02 +0000
+++ bin/export_month_timesheets	2011-06-02 15:59:48 +0000
@@ -1,8 +1,10 @@
 #!/usr/bin/env python
+from oerppy.config import get_config_data
+from oerppy.reg import registry
+
+# XXX we probably want to eventually put these addons in their own project
 from oerppy.addons.canonical import query
 from oerppy.addons.canonical.scripting import export
-from oerppy.config import get_config_data
-from oerppy.reg import registry
 
 
 # get configuration; note that option parsing is handled by the script
@@ -11,5 +13,5 @@
 # setup any addons that we want
 registry.add("canonical", query.CanonicalAddOns)
 # run the exporter
-monthly_export = export.Monthly(config_data)
+monthly_export = export.MonthlyExports(config_data)
 monthly_export.run()

=== added file 'oerppy/addons/canonical/README'
--- oerppy/addons/canonical/README	1970-01-01 00:00:00 +0000
+++ oerppy/addons/canonical/README	2011-06-02 15:59:48 +0000
@@ -0,0 +1,13 @@
+oerppy addons provide two distinct areas of functionality:
+
+    1) A supplement for the client API comprised of methods for querying
+       OpenERP addons (components that are not included in OpenERP proper), and
+
+    2) classes that provide all the logic necessary to support executable
+       scripts.
+
+These two areas are represented, respectively, by:
+
+    * the query.py module, and
+
+    * the scripting subpackage.

=== modified file 'oerppy/addons/canonical/scripting/export.py'
--- oerppy/addons/canonical/scripting/export.py	2011-06-02 15:49:02 +0000
+++ oerppy/addons/canonical/scripting/export.py	2011-06-02 15:59:48 +0000
@@ -3,32 +3,13 @@
 from oerppy import config, scripting, service
 
 
-class ExportScript(scripting.Script):
-    """
-    """
-    def get_option_parser(self):
-        """
-        Options common to all export classes.
-        """
-        parser = super(ExportScript, self).get_option_parser()
-        parser.add_option(
-            "-o", "--output-file", dest="output_filename", action="store",
-            default="stdout",
-            help="the file to write the export to")
-        parser.add_option(
-            "-f", "--format", dest="export_format", action="store",
-            default="csv",
-            help="the format to export the data in")
-        return parser
-
-
-class Monthly(ExportScript):
+class MonthlyExport(scripting.ExportScript):
     """
     Generate an export of a given month's timesheet data.
     """
     def get_option_parser(self):
         """
-        Options common to all export classes.
+        Options for monthly exports.
         """
         now = datetime.now()
         parser = super(Monthly, self).get_option_parser()

=== modified file 'oerppy/scripting/__init__.py'
--- oerppy/scripting/__init__.py	2011-06-01 16:58:57 +0000
+++ oerppy/scripting/__init__.py	2011-06-02 15:59:48 +0000
@@ -1,1 +1,1 @@
-from oerppy.scripting.base import Script
+from oerppy.scripting.base import Script, ExportScript

=== modified file 'oerppy/scripting/base.py'
--- oerppy/scripting/base.py	2011-06-02 15:49:02 +0000
+++ oerppy/scripting/base.py	2011-06-02 15:59:48 +0000
@@ -40,3 +40,24 @@
             parser.error("Options -H and -D are both required. "
                          "For more information, use --help.")
         return options
+
+
+class ExportScript(Script):
+    """
+    This class serves to provide a place for adding export-specific methods and
+    data.
+    """
+    def get_option_parser(self):
+        """
+        Options common to all export scripts.
+        """
+        parser = super(ExportScript, self).get_option_parser()
+        parser.add_option(
+            "-o", "--output-file", dest="output_filename", action="store",
+            default="stdout",
+            help="the file to write the export to")
+        parser.add_option(
+            "-f", "--format", dest="export_format", action="store",
+            default="csv",
+            help="the format to export the data in")
+        return parser