~benste/mailmanwebgsoc2011/client_fixes

« back to all changes in this revision

Viewing changes to mailman/client/_client.py

  • Committer: Benedict.Stein+ubuntu at gmail
  • Date: 2011-06-27 14:04:41 UTC
  • Revision ID: benedict.stein+ubuntu@gmail.com-20110627140441-35rq0n3nu9ya4sfl
adding additional reasarch for web_host based get_domain

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
        response, content = self._connection.call('domains', data)
180
180
        return _Domain(self._connection, response['location'])
181
181
 
182
 
    def get_domain(self, email_host):
183
 
        response, content = self._connection.call(
184
 
            'domains/{0}'.format(email_host))
185
 
        return _Domain(self._connection, content['self_link'])
 
182
    def get_domain(self, email_host, web_host=""):
 
183
    """
 
184
    get domain by it's email_host, to use web_host instead pass None instead of email_host
 
185
    """
 
186
        if email_host:
 
187
            response, content = self._connection.call(
 
188
                'domains/{0}'.format(email_host))
 
189
            return _Domain(self._connection, content['self_link'])
 
190
        elif web_host:    
 
191
            for domain in self.domains:
 
192
                if domain.url_host == web_host: #todo a8 rename to web_host
 
193
                    return domain
 
194
                
186
195
 
187
196
    def get_list(self, fqdn_listname):
188
197
        response, content = self._connection.call(
230
239
        return self._info['email_host']
231
240
 
232
241
    @property
233
 
    def url_host(self):
 
242
    def url_host(self):#TODO a8 web_host
234
243
        self._get_info()
235
244
        return self._info['url_host']
236
245