MCPcopy Index your code
hub / github.com/ddserver/ddserver / post_hosts_delete

Function post_hosts_delete

ddserver/interface/pages/user/hosts.py:166–186  ·  view source on GitHub ↗

Delete a hostname.

(user,
                      data,
                      db,
                      messages)

Source from the content-addressed store, hash-verified

164@require(db = 'ddserver.db:Database',
165 messages = 'ddserver.interface.message:MessageManager')
166def post_hosts_delete(user,
167 data,
168 db,
169 messages):
170 ''' Delete a hostname. '''
171
172 # We do not check the host id for existence and belonging as we only delete
173 # host of the user
174
175 with db.cursor() as cur:
176 cur.execute('''
177 DELETE
178 FROM hosts
179 WHERE id = %(host_id)s
180 AND user_id = %(user_id)s
181 ''', {'host_id': data.host_id,
182 'user_id': user.id})
183
184 messages.success('Ok, done.')
185
186 bottle.redirect('/user/hosts/list')

Callers

nothing calls this directly

Calls 2

cursorMethod · 0.80
successMethod · 0.80

Tested by

no test coverage detected