43 It also converts the name of the domain from IDN to ASCII, if necessary. |
43 It also converts the name of the domain from IDN to ASCII, if necessary. |
44 |
44 |
45 :param domainname: the name of the domain |
45 :param domainname: the name of the domain |
46 :type domainname: :obj:`basestring` |
46 :type domainname: :obj:`basestring` |
47 :rtype: str |
47 :rtype: str |
48 :raise VirtualMailManager.Exceptions.VMMException: if the domain name is |
48 :raise VirtualMailManager.errors.VMMError: if the domain name is |
49 too long or doesn't look like a valid domain name (label.label.label). |
49 too long or doesn't look like a valid domain name (label.label.label). |
50 |
50 |
51 .. function:: check_localpart(localpart) |
51 .. function:: check_localpart(localpart) |
52 |
52 |
53 Returns the validated local-part *localpart* of an e-mail address. |
53 Returns the validated local-part *localpart* of an e-mail address. |
54 |
54 |
55 :param localpart: The local-part of an e-mail address. |
55 :param localpart: The local-part of an e-mail address. |
56 :type localpart: str |
56 :type localpart: str |
57 :rtype: str |
57 :rtype: str |
58 :raise VirtualMailManager.Exceptions.VMMException: if the local-part is too |
58 :raise VirtualMailManager.errors.VMMError: if the local-part is too |
59 long or contains invalid characters. |
59 long or contains invalid characters. |
60 |
60 |
61 .. function:: exec_ok(binary) |
61 .. function:: exec_ok(binary) |
62 |
62 |
63 Checks if the *binary* exists and if it is executable. |
63 Checks if the *binary* exists and if it is executable. |
64 |
64 |
65 :param binary: path to the binary |
65 :param binary: path to the binary |
66 :type binary: str |
66 :type binary: str |
67 :rtype: str |
67 :rtype: str |
68 :raise VirtualMailManager.Exceptions.VMMException: if *binary* isn't a file |
68 :raise VirtualMailManager.errors.VMMError: if *binary* isn't a file |
69 or is not executable. |
69 or is not executable. |
70 |
70 |
71 .. function:: expand_path(path) |
71 .. function:: expand_path(path) |
72 |
72 |
73 Expands paths, starting with ``.`` or ``~``, to an absolute path. |
73 Expands paths, starting with ``.`` or ``~``, to an absolute path. |
118 >>> exec_ok('usr/bin/vim') |
117 >>> exec_ok('usr/bin/vim') |
119 Traceback (most recent call last): |
118 Traceback (most recent call last): |
120 File "<stdin>", line 1, in <module> |
119 File "<stdin>", line 1, in <module> |
121 File "./VirtualMailManager/__init__.py", line 93, in exec_ok |
120 File "./VirtualMailManager/__init__.py", line 93, in exec_ok |
122 NO_SUCH_BINARY) |
121 NO_SUCH_BINARY) |
123 VirtualMailManager.Exceptions.VMMException: 'usr/bin/vim' is not a file |
122 VirtualMailManager.errors.VMMError: 'usr/bin/vim' is not a file |
124 >>> exec_ok('/usr/bin/vim') |
123 >>> exec_ok('/usr/bin/vim') |
125 '/usr/bin/vim' |
124 '/usr/bin/vim' |
126 >>> expand_path('.') |
125 >>> expand_path('.') |
127 '/home/user/hg/vmm' |
126 '/home/user/hg/vmm' |
128 >>> get_unicode('hello world') |
127 >>> get_unicode('hello world') |