GithubHelp home page GithubHelp logo

pynetdot's People

Contributors

grigorescu avatar k-suler avatar matejv avatar simnv avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pynetdot's Issues

python 3 issue

When I try and run code and use python3:


Traceback (most recent call last):
  File "netdot_test_api.py", line 1, in <module>
    import pynetdot
  File "/usr/local/lib/python3.4/dist-packages/pynetdot/__init__.py", line 4, in <module>
    from .models import *
  File "/usr/local/lib/python3.4/dist-packages/pynetdot/models/__init__.py", line 3, in <module>
    import base
ImportError: No module named 'base'

dict.iteritems not spported in python 3

It seems there are still some bugs when running under python 3.

Here is one:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

~/temp/devel/netdot_extra/netdot_device.py in save_attribute(self, attribute_name, value, overwrite)
    165             da.device = self.device
    166         da.value = value
--> 167         da.save()
    168         return da
    169 

~/.virtualenvs/pynetdot/lib/python3.6/site-packages/pynetdot/netdot.py in save(self)
    192         id is not set.
    193         """
--> 194         if not self.is_dirty():
    195             # There were no changes
    196             return True

~/.virtualenvs/pynetdot/lib/python3.6/site-packages/pynetdot/netdot.py in is_dirty(self)
    156         if not self.id:
    157             return True
--> 158         return bool(self.get_dirty_fields())
    159 
    160     def display(self, view='all'):

~/.virtualenvs/pynetdot/lib/python3.6/site-packages/pynetdot/netdot.py in get_dirty_fields(self)
    147         changed_fields = dict([
    148             (key, value)
--> 149             for key, value in self._original_state.iteritems()
    150             if value != new_state[key]
    151         ])

AttributeError: 'dict' object has no attribute 'iteritems'

Documentation

Write documentation

Examples, how to generate code for Base* classes...

Person class is not usable

>>> pynetdot.Person.all()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/matej/devel/pynetdot/pynetdot/netdot.py", line 60, in all
    return cls._search()
  File "/home/matej/devel/pynetdot/pynetdot/netdot.py", line 80, in _search
    cls._from_netdot(obj, c.attrib)
  File "/home/matej/devel/pynetdot/pynetdot/netdot.py", line 127, in _from_netdot
    field.parse(obj)
  File "/home/matej/devel/pynetdot/pynetdot/fields.py", line 137, in parse
    class_ = getattr(pynetdot.models, self.link_to)
AttributeError: 'module' object has no attribute 'UserType'

Person references UserType, but this REST resurce is does not have a class - it's commented out in meta2model.py.

class BasePerson(n.Netdot):
    _fields = [
        f.LinkField('user_type', display_name='User Type', link_to='UserType'),

Support multiple version of netdot

at the same time.

We could have class definitions for each netdot version in subfolders named after the netdot version.

We can get the version of netdot used by calling /netdot/rest/ or /netdot/rest/schemainfo/. We could then load our models from appropriate subfolder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.