1 |
""" |
2 |
Variables common to all classes and functions |
3 |
|
4 |
@var __author__: name of author |
5 |
@var __license__: licence agreement |
6 |
@var __copyright__: copyrights |
7 |
@var __url__: url entry point on documentation |
8 |
@var __version__: version |
9 |
@var __date__: date of the version |
10 |
""" |
11 |
|
12 |
__copyright__=""" Copyright (c) 2006 by ACcESS MNRF |
13 |
http://www.access.edu.au |
14 |
Primary Business: Queensland, Australia""" |
15 |
__license__="""Licensed under the Open Software License version 3.0 |
16 |
http://www.opensource.org/licenses/osl-3.0.php""" |
17 |
__author__="Paul Cochrane" |
18 |
__url__="http://www.iservo.edu.au/esys" |
19 |
__version__="$Revision$" |
20 |
__date__="$Date$" |
21 |
|
22 |
|
23 |
_debug = False |
24 |
_pyvisiVersion = __version__ |
25 |
_pyvisiRevision = __version__ |
26 |
__revision__ = _pyvisiRevision |
27 |
|
28 |
import os.path |
29 |
|
30 |
def overrideWarning(methodName): |
31 |
""" |
32 |
Print a warning message for functions that need to be overridden but are |
33 |
called. |
34 |
|
35 |
@param methodName: The method name as a string. |
36 |
""" |
37 |
# print a warning message if get to here |
38 |
print "\nWarning!! If you are reading this message, then the renderer" |
39 |
print " you have chosen hasn't overridden this method as" |
40 |
print " they should have. Please contact the maintainer of" |
41 |
print " the renderer module, quoting the method name given" |
42 |
print " below, to get this problem fixed." |
43 |
print "\nMethod: %s()\n" % methodName |
44 |
|
45 |
# barf |
46 |
raise NotImplementedError, "Method not implemented by renderer" |
47 |
|
48 |
def unsupportedError(rendererName): |
49 |
""" |
50 |
Print an error message when a method is called that is defined in pyvisi |
51 |
but is not supported at the renderer module level. |
52 |
|
53 |
@param rendererName: the name of the renderer module |
54 |
@type rendererName: string |
55 |
""" |
56 |
errorString = "Sorry, but %s doesn't support this method." % rendererName |
57 |
raise NotImplementedError, errorString |
58 |
|
59 |
def fileCheck(fname): |
60 |
""" |
61 |
Check to see if the specified file exists, if not, raise an exception |
62 |
|
63 |
@param fname: the name of the file to check for |
64 |
@type fname: string |
65 |
""" |
66 |
if os.path.exists(fname) is None: |
67 |
raise ValueError, "File %s doesn't exist" % fname |
68 |
|
69 |
return |
70 |
|
71 |
def debugMsg(message): |
72 |
""" |
73 |
Convenience function for debugging messages. |
74 |
|
75 |
This function will print out a debugging message if the debug variable |
76 |
is set. |
77 |
|
78 |
@param message: the message to output if the debug flag is set |
79 |
@type message: string |
80 |
""" |
81 |
if _debug: |
82 |
print "\tBASE: %s" % message |
83 |
|
84 |
# vim: expandtab shiftwidth=4: |