CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
TableParser Namespace Reference

Functions

def extractPages
 
def extractPagesForPackage
 
def generateTab
 

Variables

list allRows = []
 
string destTabClassName = 'tabs'
 
 fileNameTemplate = None
 
 htmlFileName = None
 
 htmlFilePath = None
 
 htmlFullPath = None
 
 htmlPage = None
 
tuple newTab = generateTab(pageNames, page)
 
tuple oldTab = temp.find('div', {'class' : destTabClassName})
 
tuple page = page.replace(' ', '_')
 
tuple pageNames = pages.keys()
 
tuple pages = extractPagesForPackage()
 
tuple table = htmlPage.find('table', {'class' : tableClassName})
 
string tableClassName = 'directory'
 
tuple temp = BeautifulSoup(str(htmlPage))
 

Function Documentation

def TableParser.extractPages (   configFileFlag = False)

Definition at line 20 of file TableParser.py.

References python.multivaluedict.append(), and pileupCalc.upper.

20 
21 def extractPages(configFileFlag = False):
22  # initial page, A
23  pages = {'A':[]}
24  # find all class/namespace talbe rows.
25  table = htmlPage.find('table', {'class' : tableClassName})
26  for row in table.findAll('tr'):
27  # please see the related html file (annotated.html) to understand the
28  # approach here. you will see that, only hidden rows have style
29  # attribute and these hidden rows must be added to pages of their
30  # parents. This is why we need to check whether row has a style
31  # attribute or not.
32  styleFlag = False
33  if row.has_key('style'): styleFlag = True
34  # change the first letter if row is not hidden (child) one
35  if not styleFlag: firstLetter = row.findAll('td')[0].text[0].upper()
36  # if pages dict doesn't have the page yet..
37  if not pages.has_key(firstLetter):
38  pages[firstLetter] = []
39  # insert the row into the related page
40  if configFileFlag:
41  url = row.find('a')['href']
42  if '_cff' in url or '_cfi' in url or '_cfg' in url:
43  pages[firstLetter].append(row)
44  else:
45  pages[firstLetter].append(row)
46  return pages
47 
48 # load rows from the package documentation page. output structure:
# pages = {'PackageA' : [..], 'PackageB' : [...]}
def extractPages
Definition: TableParser.py:20
def TableParser.extractPagesForPackage ( )

Definition at line 49 of file TableParser.py.

References python.multivaluedict.append().

49 
51  # initial page, A
52  pages = {'A':[]}
53  table = htmlPage.find('table', {'class' : tableClassName})
54  for row in table.findAll('tr'):
55  # first cell contains name of the package...
56  name = row.findAll('td')[0].text
57  # parse package names --please have a look at the pages.html file
58  name = name[name.find(' '):name.find('/')].strip()
59  # if the package is not added yet
60  if not pages.has_key(name): pages[name] = []
61  pages[name].append(row)
62  return pages
63 
# generate alphabetic tab for html pages that will be generated by this script
def extractPagesForPackage
Definition: TableParser.py:49
def TableParser.generateTab (   items,
  curr,
  tabClass = 'tabs3' 
)

Definition at line 64 of file TableParser.py.

64 
65 def generateTab(items, curr, tabClass = 'tabs3'):
66  itemTagMap = {}; tab = ''
67  for item in items:
68  fn = fileNameTemplate % item # generate file name
69  if item != curr: tab += '<li><a href="%s">%s</a></li>' % (fn, item)
70  else: tab += '<li class="current"><a href="%s">%s</a></li>'%(fn, item)
71  return '<div class="%s"><ul class="tablist">%s</ul></div>' % (tabClass,tab)
def generateTab
Definition: TableParser.py:64

Variable Documentation

list TableParser.allRows = []

Definition at line 108 of file TableParser.py.

string TableParser.destTabClassName = 'tabs'

Definition at line 100 of file TableParser.py.

tuple TableParser.fileNameTemplate = None

Definition at line 14 of file TableParser.py.

tuple TableParser.htmlFileName = None

Definition at line 13 of file TableParser.py.

tuple TableParser.htmlFilePath = None

Definition at line 12 of file TableParser.py.

list TableParser.htmlFullPath = None

Definition at line 11 of file TableParser.py.

tuple TableParser.htmlPage = None

Definition at line 15 of file TableParser.py.

tuple TableParser.newTab = generateTab(pageNames, page)

Definition at line 127 of file TableParser.py.

tuple TableParser.oldTab = temp.find('div', {'class' : destTabClassName})

Definition at line 126 of file TableParser.py.

tuple TableParser.page = page.replace(' ', '_')

Definition at line 133 of file TableParser.py.

tuple TableParser.pageNames = pages.keys()

Definition at line 109 of file TableParser.py.

tuple TableParser.pages = extractPagesForPackage()

Definition at line 99 of file TableParser.py.

tuple TableParser.table = htmlPage.find('table', {'class' : tableClassName})

Definition at line 116 of file TableParser.py.

string TableParser.tableClassName = 'directory'

Definition at line 16 of file TableParser.py.

tuple TableParser.temp = BeautifulSoup(str(htmlPage))

Definition at line 124 of file TableParser.py.