Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

#!/usr/bin/python 

# encoding: utf-8 

""" 

helpers 

====================================== 

:Summary: 

    Partial for the htmlframework modules - contains helper functions for building webpages 

 

:Author: 

    David Young 

 

:Date Created: 

    May 28, 2013 

 

:dryx syntax: 

    - ``xxx`` = come back here and do some more work 

    - ``_someObject`` = a 'private' object that should only be changed for debugging 

 

:Notes: 

    - If you have any questions requiring this code please email me: d.r.young@qub.ac.uk 

""" 

 

def main(): 

    pass 

 

if __name__ == '__main__': 

  main() 

################################################################### 

# CLASSES                                                         # 

################################################################### 

 

################################################################### 

# PUBLIC FUNCTIONS                                                # 

################################################################### 

# xxx-replace 

## LAST MODIFIED : May 28, 2013 

## CREATED : May 28, 2013 

## AUTHOR : DRYX 

def unescape_html(dbConn, log, html): 

    """Unescape a string previously escaped with cgi.escape() 

 

    **Key Arguments:** 

        - ``dbConn`` -- mysql database connection 

        - ``log`` -- logger 

        - ``html`` -- the string to be unescaped 

 

    **Return:** 

        - ``html`` -- the unescaped string 

    """ 

    ################ > IMPORTS ################ 

    ## STANDARD LIB ## 

    ## THIRD PARTY ## 

    ## LOCAL APPLICATION ## 

 

    ################ > VARIABLE SETTINGS ###### 

 

    ################ >ACTION(S) ################ 

    html = html.replace("&lt;", "<") 

    html = html.replace("&gt;", ">") 

    html = html.replace("&quot;", '"') 

    # this has to be last: 

    html = html.replace("&amp;", "&") 

 

    return html 

 

################################################################### 

# PRIVATE (HELPER) FUNCTIONS                                      # 

################################################################### 

 

################################################################### 

# TEMPLATE FUNCTIONS                                              # 

###################################################################