# Module R.RepUtils

Part of Reportek

Generic functions module

Line # | Kind | Name | Docs
--- | --- | --- | ---
50 | Function | copy_file | Undocumented
88 | Function | cleanup_id | Cleanup an id
94 | Function | generate_id | Generate a unique string
109 | Function | xmlEncode | Encode some special chars
120 | Function | utGMLEncode | Giving a string and an encoding, returns the string encoded to UTF-8
157 | Function | asciiEncode | Gets a value and returns a string
164 | Function | utRead | open file
173 | Function | utf8Encode | encodes a string to UTF-8
177 | Function | utConvertToList | Convert to list
186 | Function | utConvertListToLines | Takes a list of values and returns a value for a textarea control
191 | Function | utConvertLinesToList | Takes a value from a textarea control and returns a list of values
201 | Function | utIsSubsetOf | returns true if the first list is a subset of the second
208 | Function | utSortByAttr | Sort a list of objects by one of the attributes
216 | Function | utSortByMethod | Sort a list of objects by the result of one of their functions
225 | Function | utGrabFromUrl | Takes a file from a remote server
237 | Function | parse_template | Make some text from a template file.
246 | Function | utGetTemp | return the system temp dir
253 | Function | getFilename | return only the filename, removing the path
257 | Function | createTempFile | create a file in system temp dir
269 | Function | deleteTempFile | delete a file from the system temp dir
273 | Function | cookId | generate a file ID
284 | Function | extractURLs | find all the URLs from a string
288 | Class | TmpFile | Undocumented

def copy_file(infile, outfile):
Undocumented
def cleanup_id(str):
Cleanup an id Should be more thorough and e.g. remove trailing dots/spaces

def generate_id(template):
Generate a unique string

def xmlEncode(p_string):
Encode some special chars

def utGMLEncode(p_str, p_str_enc):

Giving a string and an encoding, returns the string encoded to UTF-8 If no encoding is provided it will assume as input encoding UTF-8

Also special characters that might appear in GML files are escaped

def asciiEncode(p_value):
Gets a value and returns a string

def utRead(file):
open file

def utf8Encode(p_str):
encodes a string to UTF-8

def utConvertToList(something):
Convert to list

def utConvertListToLines(values):
Takes a list of values and returns a value for a textarea control

def utConvertLinesToList(value):
Takes a value from a textarea control and returns a list of values

def utIsSubsetOf(first_list, second_list):
returns true if the first list is a subset of the second

def utSortByAttr(p_obj_list, p_attr, p_sort_order=0):
Sort a list of objects by one of the attributes

def utSortByMethod(p_obj_list, p_attr, p_date, p_sort_order=0):
Sort a list of objects by the result of one of their functions

def utGrabFromUrl(p_url):
Takes a file from a remote server

def parse_template(template, dict={}):
Make some text from a template file.

def utGetTemp():
return the system temp dir

def getFilename(filename):
return only the filename, removing the path

def createTempFile(p_file, p_filename=''):
create a file in system temp dir

def deleteTempFile(filename):
delete a file from the system temp dir

def cookId(file):
generate a file ID

def extractURLs(s):
find all the URLs from a string