helpers
build_subject(subject=None, default='Contact/Question from visitor', timestamp_default=False)
¶
Creates the subject line for the contact email using the config or the provided subject.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject
|
a user defined subject line |
None
|
|
default
|
the default str to use if the user didn't provide a subject or ckanext.contact.subject isn't specified |
'Contact/Question from visitor'
|
|
timestamp_default
|
the default bool to use if add_timestamp_to_subject isn't specified |
False
|
Returns:
| Type | Description |
|---|---|
|
the subject line |
Source code in ckanext/contact/routes/_helpers.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
submit()
¶
Take the data in the request params and send an email using them. If the data is invalid or a recaptcha is setup and it fails, don't send the email.
Returns:
| Type | Description |
|---|---|
|
a dict of details |
Source code in ckanext/contact/routes/_helpers.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
validate(data_dict)
¶
Validates the given data and recaptcha if necessary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_dict
|
the request params as a dict |
required |
Returns:
| Type | Description |
|---|---|
|
a 3-tuple of errors, error summaries and a recaptcha error, in the event where no issues occur the return is ({}, {}, None) |
Source code in ckanext/contact/routes/_helpers.py
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 | |