Added prof_import stub
authorW. Trevor King <wking@drexel.edu>
Fri, 25 Jun 2010 19:29:22 +0000 (15:29 -0400)
committerW. Trevor King <wking@drexel.edu>
Fri, 25 Jun 2010 19:29:22 +0000 (15:29 -0400)
sitecore/prof_import.py [new file with mode: 0644]

diff --git a/sitecore/prof_import.py b/sitecore/prof_import.py
new file mode 100644 (file)
index 0000000..9b56280
--- /dev/null
@@ -0,0 +1,56 @@
+#!/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/>.
+
+"""Move Professors from MySQL -> Sitecore.
+
+Professors will be created in:
+  Content -> Drexel -> ? -> physics -> ?
+"""
+
+from selenium.common.exceptions import NoSuchElementException
+
+from . import SiteCoreConnection
+
+
+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']
+