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 19 of file TableParser.py.

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

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

Definition at line 48 of file TableParser.py.

References python.multivaluedict.append().

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

Definition at line 63 of file TableParser.py.

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

Variable Documentation

list TableParser.allRows = []

Definition at line 103 of file TableParser.py.

string TableParser.destTabClassName = 'tabs'

Definition at line 95 of file TableParser.py.

tuple TableParser.fileNameTemplate = None

Definition at line 13 of file TableParser.py.

tuple TableParser.htmlFileName = None

Definition at line 12 of file TableParser.py.

tuple TableParser.htmlFilePath = None

Definition at line 11 of file TableParser.py.

list TableParser.htmlFullPath = None

Definition at line 10 of file TableParser.py.

tuple TableParser.htmlPage = None

Definition at line 14 of file TableParser.py.

tuple TableParser.newTab = generateTab(pageNames, page)

Definition at line 122 of file TableParser.py.

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

Definition at line 121 of file TableParser.py.

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

Definition at line 128 of file TableParser.py.

tuple TableParser.pageNames = pages.keys()

Definition at line 104 of file TableParser.py.

tuple TableParser.pages = extractPagesForPackage()

Definition at line 94 of file TableParser.py.

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

Definition at line 111 of file TableParser.py.

string TableParser.tableClassName = 'directory'

Definition at line 15 of file TableParser.py.

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

Definition at line 119 of file TableParser.py.