1. Peter Sanchez
  2. zerigodns
Issue #2 resolved

hosts attribute of a zone is missing if zone has more than a certian amount of hosts

Simon Josi
created an issue

{{{

!python

zerigo_api.find_by_domain('atizo.org').hosts [<zerigodns.api.NSHost object at 0x3458ad0>, <zerigodns.api.NSHost object at 0x3458b90>, <zerigodns.api.NSHost object at 0x3458c10>, <zerigodns.api.NSHost object at 0x3458c90>, <zerigodns.api.NSHost object at 0x3458d10>, <zerigodns.api.NSHost object at 0x3458d90>, <zerigodns.api.NSHost object at 0x3458e10>, <zerigodns.api.NSHost object at 0x3458e90>, <zerigodns.api.NSHost object at 0x3458f10>, <zerigodns.api.NSHost object at 0x3458f90>, <zerigodns.api.NSHost object at 0x345c050>, <zerigodns.api.NSHost object at 0x345c0d0>, <zerigodns.api.NSHost object at 0x345c150>, <zerigodns.api.NSHost object at 0x345c1d0>] zerigo_api.find_by_domain('atizo.com').hosts Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/simu/workspace/atizo-platform-env/lib/python2.7/site-packages/zerigodns/api.py", line 68, in getattribute return super(ZerigoDNS, self).getattribute(name) AttributeError: 'NSZone' object has no attribute 'hosts'

}}}

If a domain contains a certian amount of hosts, the hosts attribute won't be populated.

atizo.org has 14 configured domains

aitizo.com has over 400 configured domains

Comments (5)

  1. Peter Sanchez repo owner

    Simon,

    Please see this commit:

    https://bitbucket.org/petersanchez/zerigodns/changeset/da3d816a9cf5799e54dc429d2678534ff06c00f7

    If you can test with that branch (branch name: issue2) and let me know your results. I don't have any domains with more than 300 hosts so I can't test it specifically with that. I have tested this with every option I can locally though.

    Now, when you do:

    a = zerigo_api.find_by_domain('atizo.com') a.hosts # Should contain the first 100 hosts. To load the next 100, you just...

    a.hosts.load() # Loads the next 100. To load ALL hosts, just:

    a.hosts.load_all() # Loads all hosts

    At any time, you can reference a.hosts. So for instance, it starts with the first 100, then you call a.hosts.load(), now a.hosts should have the first 200 hosts.

    Please let me know how it's working. I'll merge in the code if you give me the OK.

    Thanks again for reporting this!

    Peter

  2. Log in to comment