From 4f4d0ee4c31a8a776460f7c7ba37065ce30c3a74 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 25 Jun 2010 15:29:22 -0400 Subject: [PATCH] Added prof_import stub --- sitecore/prof_import.py | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sitecore/prof_import.py diff --git a/sitecore/prof_import.py b/sitecore/prof_import.py new file mode 100644 index 0000000..9b56280 --- /dev/null +++ b/sitecore/prof_import.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# Copyright (C) 2010 W. Trevor King +# +# 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 . + +"""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'] + -- 2.26.2