First attempt at professor copying code
authorW. Trevor King <wking@drexel.edu>
Mon, 28 Jun 2010 13:29:23 +0000 (09:29 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 28 Jun 2010 13:29:23 +0000 (09:29 -0400)
sitecore/prof/import.py

index 08dc4b921159fa8d03ed4d0190c833dc8019f9ad..bc5440bb88d7ac2f2e9669a110ddabbbbfa81206 100644 (file)
@@ -36,16 +36,35 @@ class ProfessorAdder (object):
         self.s = sitecore_connection
 
     def setup(self):
-        s.expand_nav_section('Media Library')
-        s.expand_nav_section('Images')
-        s.expand_nav_section('physics')
-        s.expand_nav_section('headshots')
+        #self.s.expand_nav_section('sitecore')
+        #self.s.expand_nav_section('Content')
+        self.s.expand_nav_section('Home')
+        self.s.expand_nav_section('physics')
+        self.s.expand_nav_section('contact')
+        self.s.expand_nav_section('facultyDirectory')
 
     def __call__(self, prof):
-        raw_name = TODO
-        s.open_nav_section(raw_name)
+        self.create_prof_page(prof)
+        self.s.open_nav_section(raw_name)
         TODO
 
+    def create_prof_page(self, prof):
+        self.s.open_nav_section('Copy of Shyamalendu Bose')
+        self.s.w.find_element_by_link_text('Copy To').click()
+        time.sleep(self.s.wait_time)
+        windows = self.w.get_window_handles()
+        current_window = self.w.get_current_window_handle()
+        self.logger.info('handling copy popup %s (from %s)'
+                         % (current_window, windows))
+        name = self.s.find_element_by_id('Filename')
+        name.clear()
+        name.send_keys(
+            '/sitecore/content/Home/physics/contact/facultyDirectory/%s %s'
+            % (prof.name.first, prof.name.last))
+        self.s.w.find_element_by_link_text('Copy').click()
+        time.sleep(self.s.wait_time)
+
+
 def main(argv):
     import optparse
     usage = """%prog [options] PROF_FILE
@@ -77,6 +96,6 @@ Example setup before running:
         a = ProfessorAdder(s)
         a.setup()
         for prof in profs:
-            a.aadd_profs(s, profs)
+            a.add_profs(s, profs)
     finally:
         s.stop()