From efa6075f97f350c2b2ec7f37dad675709a608aab Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Sep 2013 10:25:59 +0530 Subject: [PATCH 1/7] test change --- scholar2xbundle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scholar2xbundle.py b/scholar2xbundle.py index d154a9b..1426dde 100644 --- a/scholar2xbundle.py +++ b/scholar2xbundle.py @@ -142,7 +142,7 @@ def add_contents_to_vert(self, vxml, vert): except Exception as err: print " ERROR reading %s: %s" % (fn, err) return - nav = vcontents.find('.//div[@id="parent-fieldname-text"]') # v.find('.//p[@class="sc_nav"]') + nav = vcontents.find('.//p[@class="sc_nav"]') # v.find('.//p[@class="sc_nav"]') html = etree.SubElement(vert,'html') html.set('display_name',vert.get('display_name','Page')) for p in nav: From 739f16734153e100621deda43a817ac957f082b1 Mon Sep 17 00:00:00 2001 From: mitsupport Date: Thu, 19 Sep 2013 10:30:49 +0530 Subject: [PATCH 2/7] Commited changes at line:145 --- scholar2xbundle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scholar2xbundle.py b/scholar2xbundle.py index d154a9b..1426dde 100644 --- a/scholar2xbundle.py +++ b/scholar2xbundle.py @@ -142,7 +142,7 @@ def add_contents_to_vert(self, vxml, vert): except Exception as err: print " ERROR reading %s: %s" % (fn, err) return - nav = vcontents.find('.//div[@id="parent-fieldname-text"]') # v.find('.//p[@class="sc_nav"]') + nav = vcontents.find('.//p[@class="sc_nav"]') # v.find('.//p[@class="sc_nav"]') html = etree.SubElement(vert,'html') html.set('display_name',vert.get('display_name','Page')) for p in nav: From cfb79050fc6f58f1d42b667e3dc2c179b1f8f135 Mon Sep 17 00:00:00 2001 From: mitsupport Date: Thu, 19 Sep 2013 10:36:17 +0530 Subject: [PATCH 3/7] Changes made at line: 145 --- scholar2xbundle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scholar2xbundle.py b/scholar2xbundle.py index 1426dde..a6f4f40 100644 --- a/scholar2xbundle.py +++ b/scholar2xbundle.py @@ -142,7 +142,7 @@ def add_contents_to_vert(self, vxml, vert): except Exception as err: print " ERROR reading %s: %s" % (fn, err) return - nav = vcontents.find('.//p[@class="sc_nav"]') # v.find('.//p[@class="sc_nav"]') + nav = vcontents.find('.//p[@class="sc_nav"]') html = etree.SubElement(vert,'html') html.set('display_name',vert.get('display_name','Page')) for p in nav: From e2a13dfacbf7f026bf5abdc3d48a3a824d495a56 Mon Sep 17 00:00:00 2001 From: mitsupport Date: Thu, 19 Sep 2013 07:11:01 +0100 Subject: [PATCH 4/7] Changes made at line : 145 --- scholar2xbundle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scholar2xbundle.py b/scholar2xbundle.py index d154a9b..a6f4f40 100644 --- a/scholar2xbundle.py +++ b/scholar2xbundle.py @@ -142,7 +142,7 @@ def add_contents_to_vert(self, vxml, vert): except Exception as err: print " ERROR reading %s: %s" % (fn, err) return - nav = vcontents.find('.//div[@id="parent-fieldname-text"]') # v.find('.//p[@class="sc_nav"]') + nav = vcontents.find('.//p[@class="sc_nav"]') html = etree.SubElement(vert,'html') html.set('display_name',vert.get('display_name','Page')) for p in nav: From d93d1da4364499e64b3218926cc1043d011c620c Mon Sep 17 00:00:00 2001 From: mitsupport Date: Fri, 20 Sep 2013 10:27:58 +0100 Subject: [PATCH 5/7] Corrected the line:145 in schloar2xbundle.py --- scholar2xbundle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scholar2xbundle.py b/scholar2xbundle.py index a6f4f40..bcc75b7 100644 --- a/scholar2xbundle.py +++ b/scholar2xbundle.py @@ -142,7 +142,7 @@ def add_contents_to_vert(self, vxml, vert): except Exception as err: print " ERROR reading %s: %s" % (fn, err) return - nav = vcontents.find('.//p[@class="sc_nav"]') + nav = vcontents.find('.//div[@id="course_inner_section"]') html = etree.SubElement(vert,'html') html.set('display_name',vert.get('display_name','Page')) for p in nav: From 6eba85c55b50cf49f534220273a167f88f338109 Mon Sep 17 00:00:00 2001 From: mitsupport Date: Tue, 24 Sep 2013 08:00:42 +0100 Subject: [PATCH 6/7] Final Changes made in schloar2xbundle.py and xbundle.py --- scholar2xbundle.py | 27 +++++++++++++++++++++++++++ xbundle.py | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/scholar2xbundle.py b/scholar2xbundle.py index bcc75b7..c90bd95 100644 --- a/scholar2xbundle.py +++ b/scholar2xbundle.py @@ -113,6 +113,25 @@ def add_pdf_link_to_vert(self, pdffn, text, vert): print " html link: %s = %s" % (dn, newpath) vert.append(html) + def add_py_link_to_vert(self, pyfn, text, vert): + ''' + Add with link to PY file to vertical + ''' + newpath = self.fix_static('../' + pyfn) + dn = text.strip() + html = etree.XML('%s' % (newpath, dn)) + print " html link: %s = %s" % (dn, newpath) + vert.append(html) + + def add_txt_link_to_vert(self, txtfn, text, vert): + ''' + Add with link to txt file to vertical + ''' + newpath = self.fix_static('../' + txtfn) + dn = text.strip() + html = etree.XML('%s' % (newpath, dn)) + print " html link: %s = %s" % (dn, newpath) + vert.append(html) def add_contents_to_vert(self, vxml, vert): ''' @@ -134,6 +153,14 @@ def add_contents_to_vert(self, vxml, vert): if vfn.endswith('.pdf'): self.add_pdf_link_to_vert(vfn, vxml.text, vert) return + + if vfn.endswith('.py'): + self.add_py_link_to_vert(vfn, vxml.text, vert) + return + + if vfn.endswith('.txt'): + self.add_txt_link_to_vert(vfn, vxml.text, vert) + return # process html file try: diff --git a/xbundle.py b/xbundle.py index bcbbb54..28c013f 100755 --- a/xbundle.py +++ b/xbundle.py @@ -407,6 +407,10 @@ def write_xml(x): elem.attrib.pop('url_name') if 'url_name_orig' in elem.attrib and self.keep_urls: elem.attrib.pop('url_name_orig') + + if un.__len__() > 182: + un = un[:182-un.__len__()] + edir = self.mkdir(self.dir / x.tag) open(edir/un + '.xml','w').write(self.pp_xml(x)) return un From cc842a79ed1c5fead7ba5c7717e8cf0423657259 Mon Sep 17 00:00:00 2001 From: mitsupport Date: Tue, 24 Sep 2013 08:08:22 +0100 Subject: [PATCH 7/7] Corrected the indentation in schloar2xbundle.py and xbundle.py --- scholar2xbundle.py | 9 +++------ xbundle.py | 6 ++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/scholar2xbundle.py b/scholar2xbundle.py index c90bd95..0c21ae9 100644 --- a/scholar2xbundle.py +++ b/scholar2xbundle.py @@ -112,8 +112,8 @@ def add_pdf_link_to_vert(self, pdffn, text, vert): html = etree.XML('%s' % (newpath, dn)) print " html link: %s = %s" % (dn, newpath) vert.append(html) - - def add_py_link_to_vert(self, pyfn, text, vert): + + def add_py_link_to_vert(self, pyfn, text, vert): ''' Add with link to PY file to vertical ''' @@ -122,7 +122,6 @@ def add_py_link_to_vert(self, pyfn, text, vert): html = etree.XML('%s' % (newpath, dn)) print " html link: %s = %s" % (dn, newpath) vert.append(html) - def add_txt_link_to_vert(self, txtfn, text, vert): ''' Add with link to txt file to vertical @@ -153,11 +152,9 @@ def add_contents_to_vert(self, vxml, vert): if vfn.endswith('.pdf'): self.add_pdf_link_to_vert(vfn, vxml.text, vert) return - - if vfn.endswith('.py'): + if vfn.endswith('.py'): self.add_py_link_to_vert(vfn, vxml.text, vert) return - if vfn.endswith('.txt'): self.add_txt_link_to_vert(vfn, vxml.text, vert) return diff --git a/xbundle.py b/xbundle.py index 28c013f..3d146a7 100755 --- a/xbundle.py +++ b/xbundle.py @@ -407,10 +407,8 @@ def write_xml(x): elem.attrib.pop('url_name') if 'url_name_orig' in elem.attrib and self.keep_urls: elem.attrib.pop('url_name_orig') - - if un.__len__() > 182: - un = un[:182-un.__len__()] - + if un.__len__() > 182: + un = un[:182-un.__len__()] edir = self.mkdir(self.dir / x.tag) open(edir/un + '.xml','w').write(self.pp_xml(x)) return un