equal
deleted
inserted
replaced
311 domdict[gid] = [None, dom] |
311 domdict[gid] = [None, dom] |
312 del doms |
312 del doms |
313 return order, domdict |
313 return order, domdict |
314 |
314 |
315 def get_gid(dbh, domainname): |
315 def get_gid(dbh, domainname): |
316 """Returns the *GID* of the domain *domainname*. |
316 """Returns the group id of the domain *domainname*. |
317 |
317 |
318 Raises an `DomainError` if the domain does not exist. |
318 If the domain couldn't be found in the database 0 will be returned. |
|
319 |
319 """ |
320 """ |
320 domainname = check_domainname(domainname) |
321 domainname = check_domainname(domainname) |
321 dbc = dbh.cursor() |
322 dbc = dbh.cursor() |
322 dbc.execute('SELECT gid FROM domain_name WHERE domainname=%s', domainname) |
323 dbc.execute('SELECT gid FROM domain_name WHERE domainname=%s', domainname) |
323 gid = dbc.fetchone() |
324 gid = dbc.fetchone() |
324 dbc.close() |
325 dbc.close() |
325 if gid: |
326 if gid: |
326 return gid[0] |
327 return gid[0] |
327 else: |
328 return 0 |
328 raise DomErr(_(u"The domain ā%sā doesn't exist.") % domainname, |
|
329 NO_SUCH_DOMAIN) |
|