Moved prof_import/export down into sitecore/prof.
authorW. Trevor King <wking@drexel.edu>
Sat, 26 Jun 2010 19:49:18 +0000 (15:49 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 26 Jun 2010 19:50:38 +0000 (15:50 -0400)
Also moved doc/faculty.txt into the sitecore.prof doctring.

doc/faculty.txt [deleted file]
sitecore/prof/__init__.py [new file with mode: 0644]
sitecore/prof/export_mysql.py [moved from sitecore/prof_export.py with 97% similarity]
sitecore/prof/import.py [moved from sitecore/prof_import.py with 72% similarity]

diff --git a/doc/faculty.txt b/doc/faculty.txt
deleted file mode 100644 (file)
index eb51288..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-Sitecore Faculty Profile       Corresponding Information
-
-Faculty Information
--------------------
-Degrees*       Degrees Earned (i.e. Dr., PhD)
-College*       University Graduated From
-Program        Area Within Department (i.e. Anthropology)
-Office*        Office Location
-Office Hours   (If applicable)
-Specialization*        Research Areas/Specialization
-Publications   Publications Listing (If applicable)
-Professional Society   (If applicable)
-Academic Distinctions  (If applicable)
-Research Interests     (Please use "Specialization" Field)
-Personal Site  Website Address (If applicable)
-
-Personal Profile
-----------------
-Title* Professional Title (i.e. Director of Publication Management)
-First Name*    First Name / Middle Name
-Last Name*     Last Name
-Bio    Brief Bio/Profile/Blurb
-Short Bio      Presentations (If applicable)
-Headshot*      Photograph – Size should be width: 125px height: 150px 
-Email* Email
-Phone* Phone # ‐ Please use this format: (111) 111‐1111
-Fax    Lab Name, Lab Phone (If applicable, please use "Lab Name, Lab Phone" format)
-CV     Resume
-
-* field required.
-
-If a basic text field (a field with no "editor") has more than one
-item in it then separate the items with a comma. For example: If a
-faculty member has more than one title, then list their titles like
-this: Professor of Communication, Director of Publication Management,
-Yearbook Advisor, etc.
diff --git a/sitecore/prof/__init__.py b/sitecore/prof/__init__.py
new file mode 100644 (file)
index 0000000..fd91f36
--- /dev/null
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
+#
+# This file is part of SiteCorePy.
+#
+# SiteCorePy 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.
+#
+# SiteCorePy 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 SiteCorePy.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+Sitecore Faculty Profile       Corresponding Information
+
+Faculty Information
+-------------------
+Degrees*       Degrees Earned (i.e. Dr., PhD)
+College*       University Graduated From
+Program        Area Within Department (i.e. Anthropology)
+Office*        Office Location
+Office Hours   (If applicable)
+Specialization*        Research Areas/Specialization
+Publications   Publications Listing (If applicable)
+Professional Society   (If applicable)
+Academic Distinctions  (If applicable)
+Research Interests     (Please use "Specialization" Field)
+Personal Site  Website Address (If applicable)
+
+Personal Profile
+----------------
+Title* Professional Title (i.e. Director of Publication Management)
+First Name*    First Name / Middle Name
+Last Name*     Last Name
+Bio    Brief Bio/Profile/Blurb
+Short Bio      Presentations (If applicable)
+Headshot*      Photograph – Size should be width: 125px height: 150px 
+Email* Email
+Phone* Phone # ‐ Please use this format: (111) 111‐1111
+Fax    Lab Name, Lab Phone (If applicable, please use "Lab Name, Lab Phone" format)
+CV     Resume
+
+* field required.
+
+If a basic text field (a field with no "editor") has more than one
+item in it then separate the items with a comma. For example: If a
+faculty member has more than one title, then list their titles like
+this: Professor of Communication, Director of Publication Management,
+Yearbook Advisor, etc.
+"""
+
+class AttributeHolder (object):
+    self.fields = []
+    def __init__(self, *args, **kwargs):
+        for field in self.fields:
+            setattr(self, field, None)
+        for field,arg in zip(self.fields, args):
+            setattr(self, field, arg)
+        for field,value in kwargs.items():
+            assert field in self.fields, '%s not in %s' % (field, self.fields)
+            setattr(self, field, value)
+
+
+class Name (AttributeHolder):
+    self.fields = ['first_middle', 'last']
+
+class Graduation (AttributeHolder):
+    self.fields = ['college', 'title', 'year']
+
+class Contact (AttributeHolder):
+    self.fields = ['office', 'website', 'phone', 'lab', 'lab_phone']
+
+class Bio (AttributeHolder):
+    self.fields = ['specialization', 'publications', 'profile', 'cv']
+
+class Professor (object):
+    self.fields = ['name', 'graduations', 'contact', 'bio']
similarity index 97%
rename from sitecore/prof_export.py
rename to sitecore/prof/export_mysql.py
index 0de8037fc4e4b9a4e168f35946f6a00b81b56bb0..88871deb6f24a3e7b886d510263ba5ca8f54ef7d 100644 (file)
@@ -26,9 +26,10 @@ import getpass
 import logging
 
 import MySQLdb
+import yaml
 
-from . import get_logger
-from .prof_import import Name, Graduation, Contact, Bio, Professor
+from .. import get_logger
+from . import Name, Graduation, Contact, Bio, Professor
 
 
 class SimpleDB (object):
@@ -158,7 +159,7 @@ if __name__ == '__main__':
 Where PROF_FILE is the output YAML file receiving professor data.
 
 Example:
-  ./sitecore/prof_export.py profs.yaml
+  ./sitecore/prof/export_mysql.py profs.yaml
 """
     p = optparse.OptionParser(usage)
     p.add_option('-d', '--database', metavar='NAME', dest='database',
similarity index 72%
rename from sitecore/prof_import.py
rename to sitecore/prof/import.py
index fb7ed000f7e2d5b8747785e4d99fd37918c6d25d..d9110c8f19da8bd486aa31f3a8abe0e3d469ee59 100644 (file)
@@ -23,37 +23,10 @@ Professors will be created in:
 """
 
 from selenium.common.exceptions import NoSuchElementException
-
-from . import SiteCoreConnection
 import yaml
 
-
-class AttributeHolder (object):
-    self.fields = []
-    def __init__(self, *args, **kwargs):
-        for field in self.fields:
-            setattr(self, field, None)
-        for field,arg in zip(self.fields, args):
-            setattr(self, field, arg)
-        for field,value in kwargs.items():
-            assert field in self.fields, '%s not in %s' % (field, self.fields)
-            setattr(self, field, value)
-
-
-class Name (AttributeHolder):
-    self.fields = ['first_middle', 'last']
-
-class Graduation (AttributeHolder):
-    self.fields = ['college', 'title', 'year']
-
-class Contact (AttributeHolder):
-    self.fields = ['office', 'website', 'phone', 'lab', 'lab_phone']
-
-class Bio (AttributeHolder):
-    self.fields = ['specialization', 'publications', 'profile', 'cv']
-
-class Professor (object):
-    self.fields = ['name', 'graduations', 'contact', 'bio']
+from .. import SiteCoreConnection
+from . import Name, Graduation, Contact, Bio, Professor
 
 
 class ProfessorAdder (object):
@@ -83,7 +56,7 @@ Example setup before running:
   Xvfb :99 > /dev/null 2>&1 &
   export DISPLAY=:99
   java -jar selenium-server-1.0.2-SNAPSHOT-standalone.jar > /dev/null 2>&1 &
-  ./sitecore/prof_import.py profs.yaml
+  ./sitecore/prof/import.py profs.yaml
 """
     p = optparse.OptionParser(usage)
     p.add_option('-u', '--url', metavar='URL', dest='url',