Any suggestions on how to deal with keywords args in Java PB referenceables?
If I just ignore them I can make methods in Referenceables be a lot more
public Object remote_foo(Integer x)
public Object remote_foo(Object args, Map kwargs)
And allow method overloading too.
I could of course implement both policies in different classes, in which
case I'd be happy for suggestions on a name for such classes.
Sorry. I didn't have the latest CVS. That last bug is obsolete. :( But heh,
I have a couple other bugs to report now :) (There was a syntaxerror in toc.py,
but I've already fixed that myself.)
First off, loading of the ~/.imsaved pickles doesn't work. I get an EofError
every time on the cPickle.load(file).
second, I'm getting this:
Traceback (most recent call last):
File "/home/punck/cvs/Twisted/bin/im", line 54, in ?
File "/home/punck/cvs/Twisted/twisted/words/ui/tkim.py", line 721, in main
File "/home/punck/cvs/Twisted/twisted/words/ui/im3.py", line 507, in saveState
NameError: global name 'gateway' is not defined
whenever I close the IM window after I've already logged on.
<Yosomono@efnet> swing is to gui programming what cupholders are to cdrom drives
<Yosomono@efnet> something easily mistaken for the real thing
<<< radix(a)twistedmatrix.com >>>
Traceback (most recent call last):
File "/usr/lib/python2.1/lib-tk/Tkinter.py", line 1285, in __call__
return apply(self.func, args)
File "/home/punck/cvs/Twisted/twisted/words/ui/tkim.py", line 639, in logOnOff
File "/home/punck/cvs/Twisted/twisted/words/ui/tkim.py", line 645, in logonAccount
File "/home/punck/cvs/Twisted/twisted/words/ui/im3.py", line 508, in logonAccount
for foo,key,bar in gateways.__gateways__[account.gatewayname].loginOptions:
ValueError: unpack list of wrong size
this happened while running accepttests. I was trying to log on to my test account.
I hit "log on/off" and then that traceback happened, and it just says "attempting"
in the connection status.
<mbac> all my life i've hated object oriented programming
<mbac> when the problem was simply that i was using C++
<<< radix(a)twistedmatrix.com >>>
Say, what's up with the proliferationg of numbered imX.py files?
Anyway, what I meant to say was:
im3.py:492: No global (gateway) found
The moon is waning crescent, 16.9% illuminated, 25.5 days old.
So, there's been some confusion expressed (by certain
sleep-deprived individuals) about what it is that the
class twisted.python.explorer.ObjectBrowser is for.
Given that this is the first-pass implementation and
a number of questionable decisions were made in the
implementation, that's to be expected.
One train of questions goes like this:
Q) Why is ObjectBrowser a class at all, and not just a collection of
A) You're right, the browse_* methods make no use of an
ObjectBrowser instance's state, and could well be static functions.
The only reason to inXXX (what's the verb "to create an instance of
a class"?) ObjectBrowser is so it can hold on to a consistant
(See also the comment preceding the browse_ definitons for another
reason why these methods should be gathered in a container.)
Q) What's it doing holding namespaces?
A) It eval()uates the identifiers (identifiying expressions, really)
given to it in its namespace.
Q) Ugh. What's ObjectBrowser got to use eval() for? Why doesn't it
just take an object?
And thus we arrive at the crux of the issue.
Here's my thinking:
Requirement: When an object is "browsed", the result will contain
references to other objects; it's attributes, sequence elements, etc.
It must be easy for the user to take one of those references and
browse that object.
Requirement: ObjectBrowser be usable via remote interface, i.e. PB or
Consequence: When returning references to other objects in its results,
ObjectBrowser cannot return Python references to the objects themselves.
It must return some more "portable" reference which can freely be passed
both ways through the boundry of this Python process.
This is not the first time man has encountered such a problem; it's the
same problem Pickle faces when referencing objects "outside the pickled
data stream". It's central to the whole concept of Perspective Broker
remote references. It's why Glyph keeps saying we need some sort of URI
to identify objects with.
But not every object is pb.Referenceable, and we don't have a distributed
object URI scheme yet. So the only way I can think of to refer to a
particular object is the way a programmer refers to the object when
speaking to the interpter -- by its identifier. that string which, when
evaluated by the interpreter, is a reference to the object. So that's
what ObjectBrowser returns. ObjectLinks represeting objects with
Now we go back to the first requirement, "It must be easy for the user
to take one of those references and browse that object." Or, as a unit
lookAtMe = SomeThing()
# Look at this object.
objectLink1 = browser.browseIdentifier('lookAtMe')
# Now look at some object related to this one.
# Simplest case: I am related to me.
myIdentifier = objectLink1.identifier
objectLink2 = browser.browseIdentifier(myIdentifier)
# Did I get the object with the desired relation?
# (Simplest case: Was I really me?)
Now, to obtain objectLink1, you could argue that we could have used
browser.browseObject(object=lookAtMe, identifier='lookAtMe'), and you're
right. But to obtain objectLink2, when we only have the contents of
objectLink1 to work from, we only have the identifier to pass back.
So that's why I think ObjectBrowser needs to accept identifiers,
and that's why I guess ObjectBrowser has to use eval(),
Questions, comments, reservations?
Kevin Turner <acapnotic(a)twistedmatrix.com> | OpenPGP encryption welcome here
The moon is waning crescent, 18.2% illuminated, 25.4 days old.
1) For clarity's sake, turn pb into a package:
2) the methods for connecting to a server assume you are using TCP - they
should use the new connectTCP, connectSSL, etc. API when we do *that* refactor.
1) Use SRP instead of whatever the current challenge/response is - see
2) Make a login system that uses X.509 certificates for identities (SSL only).
3) Look at SPKI for an alternate certificate-based system (RFC 2693).
This conversation has been edited for length, to fit your screen, and,
in some cases, content:
<itamar> hi glyph
<glyph> hit itamar
<glyph> hi itamar, even ;)
<itamar> I'm glad to say we now have java interop
<glyph> itamar: So I read from the list
<itamar> now's about the point where I could use some help
<itamar> not that that's gonna happen
<glyph> itamar: So I thought of another cool hack that you might want to
<glyph> totally unrelated to java ;)
<glyph> itamar: Don't run away --
<glyph> "The configuration system"
<glyph> itamar: I just had a conversation about it last night.
<itamar> what exactly where you thinking of?
<glyph> itamar: Let me ramble about vision for a moment (you'll probably
see this in an email sometime soon, too)
<glyph> Twisted isn't a particularly great webserver, when you compare
functionality blow-for-blow with apache. It's not a great chatserver,
when it has to slug it out with ircd. But we all like Twisted more than
either of those -- why?
<glyph> Well, because it's an IRC server *and* a web server.
<glyph> What makes Twisted special is the degree of integration that it
allows for all its services.
<glyph> However, this integration is effectively lost to anyone who
isn't a programmer (and to some extent, to anyone who isn't already
rather familiar with the codebase) because there's no metaphor for the
integration. Everything is rather concrete, speaking in terms of file
descriptors and delayed events and what-have-you.
<itamar> glyph: ok -
<glyph> With the refactoring that we're talking about, centering around
t.i.m.A, there is going to be at least a common metaphor for what stuff
connects to what bit of the network...
<glyph> The configuration application that I envision has a unified
notion of the "things that do stuff", although I haven't come up with a
good name for them. Zope-like, you'll have a menu to create an object
of lots of different types (like a Words service, a mail service, a web
site, etc), some of which listen on ports directly, some of which are
indirectly connected to the network through PB publishers or web
<itamar> well, meanwhile it sounds like a mktap with a slightly better UI
<glyph> itamar: the use-case that I'm thinking of for it is creating a
web site and a words service, hooking up a tendril to a persistent IRC
server, creating a personal website and mounting the registration and
userlist widgets somewhere within your personal web space.
<itamar> hmmm... a configuration tool for web would be quite nice for
<glyph> itamar: Note that I mention spawning a tendril as well -- one of
the goals of this tool would be to unify mktap and im. You really ought
to just create a "persistent outgoing chat connection w/ Tkinter UI" as
an object, put it in your tap, and have it run in your personal twistd
<glyph> itamar: this would also clearly define the role of "plugins" --
they are code which adds stuff to that menu of base types of objects one
<glyph> I'm inclined to say that for starters, each object defines its
own web form that allows you to configure it
<itamar> how would you model something that connects web and a words
<itamar> this is where you start wishing for a 3d gui
<glyph> itamar: optimally, yeah, you'd have something like a 3D visio
where you could dynamically drag connections
<itamar> actually a 2d one would do
<glyph> but working with "web form" as the metaphor, there's still quite
a lot you can do :)
<itamar> where you drag lines from a object to another
<glyph> when you create a words service, it publishes several web
objects, none of which are connected to anything
<glyph> so when you go to a page that wants to pop up a list of possible
objects you could add as a web resource, those appear.
<glyph> It's like your application has a "bag" of sub-objects that you
"carry around" in the configuration interface
<itamar> I like it. of course my innate dislike of web (or GUI, for that
matter) programming is getting in the way.
<itamar> but it would be good for my software as well, since it has all
these pluggable components you need to mix and match
<itamar> and then there's monitoring components (web, nt performance
<itamar> and logging components (syslog, file, nt log)
<glyph> itamar: Yeah. The reason that this configuration thing came to
me is because someone who was asked to do a technical evaluation of
Twisted, upon completing his evaluation, had only one thing to say
<glyph> "What is it *for*?"
<itamar> what is what for?
<glyph> itamar: What is Twisted for.
<sayke> glyph: that was my response. "that's a damn impressive kitchen
sink ya got there" ;)
<glyph> itamar: and I realized that *this* is what Twisted is for. Even
though we don't have a very good metaphor for it or interface to it, no
other server framework even aspires to this sort of integrated
<glyph> There are a few "java Application servers" that make-believe,
except that they ONLY do web, and ONLY for business, and severely limit
the sort of apps you can write with them.
<itamar> yeah, or Zope, which has ftp/http/webdav/xmlrpc, but attempts
to add nttp or imap have failed
<glyph> itamar: ftp/http/webdav/xmlrpc are still all just ways of
publishing structured documents
<glyph> itamar: they're not fundamentally different ways of interacting
with the system
<glyph> itamar: nntp and imap, strangely enough, are :)
<itamar> well, actually, there's a irc bot written for zope
<itamar> on to concretes - is there any way we can do without a web
<glyph> itamar: well, a first step in this direction is just a unified
set of utility methods :)
<itamar> how about anygui? they are promising a html interface
<glyph> itamar: anygui is crack
<itamar> and a curses interface
<itamar> glyph: why do you say that?
<glyph> itamar: Have you ever done any work with webwidgets?
<glyph> itamar: take a look at the form widget
<glyph> itamar: it's staggeringly little code to write
<itamar> one sec
<itamar> where can I find an example?
<glyph> You might have to refactor it a little bit, but the basic idea
is you define what inputs your form takes, then it renders the form for
you and calls back to a method with the appropriate signature with each
form value as an arguemnt when the user POSTs
<itamar> ok, so we can have a generic configuration API, and have a web
interface to that, and a tkinter interface to it etc.?
<glyph> itamar: twisted.web.guard.AuthForm
<glyph> itamar: yes.
<glyph> itamar: I don't want to do anygui, because I'd like the tkinter
interface to be *different* from the web interface. To begin with I
think we should go with web-only and refactor once we see what
ocnfiguration patterns emerge, but if you want to go with tkinter-only
or gtk-only for the first pass... hey, I don't have the time to write
<itamar> how about registry.registerThingie(type, description,
<itamar> I'm going to eat
<itamar> glyph: mail the log to the list
______ you are in a maze of twisted little applications, all
| |_\ remarkably consistent.
| | -- glyph lefkowitz, glyph @ twisted matrix . com