Questions tagged [zope.interface]

The zope.interface module provides an implementation of "object interfaces" for Python.

Interfaces are a mechanism for labeling objects as conforming to a given API or contract. The zope.interface package can be considered as an implementation of the Design By Contract methodology in Python.

zope.interface does not depend on the Zope server framework and does not imply using any other part of Zope.

53 questions
1
vote
2 answers

I want to use ZopeInterfaces, however my project is based on Python 3.x - any suggestions?

Zope Interfaces are a great way to get some Java-style "design by contract" into a python program. It provides some great features such as implement-able interfaces and a really neat pattern for writing adaptors for objects. Unfortunately, since…
Salim Fadhley
  • 22,020
  • 23
  • 75
  • 102
1
vote
0 answers

How to use Python's twisted.internet for XBMC add-on development?

I just tried to use the Python module twisted.internet for an XBMC add-on that I am currently writing. When I tried to execute my add-on, I got an exception that I could not understand. I was quite suprised when I noticed that the following lines…
Markus Mayr
  • 4,038
  • 1
  • 20
  • 42
1
vote
2 answers

Zope interface inheritance: Why doesn't it show up in interface.providedBy()?

I would expect when I make an interface IB inherit from IA, then use interface.providedBy() to query an instance of B (which implements IB), I would see both IA and IB in the list. However, that doesn't seem to be the case. from zope import…
1
vote
0 answers

ComponentLookupError raised while looking up widget manager in testing environment

I'm trying to develop a new widget using z3c.forms and I've got to the point when I can do functional testings. Unfortunately, when I setup tests with forms, when updateWidgets is called ComponentLookupError is raised for IWidgets interface, which…
Alex Volkov
  • 2,812
  • 23
  • 27
1
vote
1 answer

Storing pairs of strings inside plone.app.registry

I need to build a configuration panel in the Plone control panel that store couples, and I'd like to use plone.app.registry on Plone 3. If I limit myself to the user interface, it's quite simple to define a schema interface that automatically build…
keul
  • 7,673
  • 20
  • 45
1
vote
2 answers

Why would a subclass of a subclass of zope.interface.Interface not inherit its parents names?

Example: >>> from zope.interface import Interface, Attribute >>> class IA(Interface): ... foo = Attribute("foo") ... >>> IA.names() ['foo'] >>> class IB(IA): ... bar = Attribute("bar") ... >>> IB.names() ['bar'] How can I have IB.names()…
Ben
  • 2,422
  • 2
  • 16
  • 23
1
vote
1 answer

Where do I put exception definitions common to an interface?

I am getting into the habit of using zope.interface when designing certain classes, which is all well and nice, but I am a bit unsure about exceptions. I haven't seen any docs talking about them (albeit after cursory searching only). Primarily, I am…
porgarmingduod
  • 7,668
  • 10
  • 50
  • 83
0
votes
2 answers

twisted.internet.interfaces.ITransport.write: Expected 0 positional arguments

This is my code: from twisted.protocols.basic import LineReceiver from twisted.internet.interfaces import ITransport class AbcProtocol(LineReceiver): transport: ITransport def lineReceived(self, line: bytes) -> None: …
gamecss
  • 7
  • 3
0
votes
1 answer

Zope.interface in Django

I am from a Java background and now working on a django application. Need your input if I am in the wrong direction. I am trying to implement zope.interface.Interface in my Django application and trying to achieve what interfaces in Java do, but it…
0
votes
0 answers

P2Pool: Twisted Abort Connection Error

I keep running into this error that I never had before every time I try running python run_p2pool.py, I even tried doing -n and typing in the argument and that doesn't fix it (as the internet suggested). I also have the configurations already there…
ConfusedDev
  • 31
  • 2
  • 7
0
votes
2 answers

Verify that an unknown module/object is obliged to a specific interface (python)

I'd like to check at runtime, for example, that a given object has methods foo() and bar(). My research system, built in python 3.6, is highly parameterized and can/should accept any kind of object as a replacement of its build in modules. This…
Liran Funaro
  • 2,750
  • 2
  • 22
  • 33
0
votes
1 answer

How to upload zope site on my ftp?

Hey, I'd like to know how to upload my zope site on my ftp. I have a domain, and I like to upload it, like a upload normal files on my ftp. Thanks.
rogcg
  • 10,451
  • 20
  • 91
  • 133
0
votes
1 answer

ImportError: No module named 'zope.interface'

On Mac: Traceback (most recent call last): File "project1/scripts/initializedb.py", line 3, in import transaction File "/Users/denmojo/code/project1/env/lib/python3.5/site-packages/transaction/__init__.py", line 19, in
denmojo
  • 223
  • 2
  • 8
0
votes
1 answer

no module named Zope.interface error when using cx_Freeze

I have created a modbus server script using twisted and few other modules. In Anaconda spyder tool, the script works fine but when i create exe file using cx_freeze tool, i get the below error. Twisted requires zope.interface 3.6.0 or later: no…
0
votes
0 answers

Why does installing zope.interface fail?

I've been trying to get PyModbus3 to work in Python 3.4 (64 bit) but it fails on it's requirement for the zope interface: C:\Users\jonc\Downloads>pip install zope.interface Downloading/unpacking zope.interface Running setup.py…
Jon Cage
  • 36,366
  • 38
  • 137
  • 215