Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
068ad973
Commit
068ad973
authored
Jun 09, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Untabified -- to satisfy the tab nanny.
parent
5a43e1a9
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
230 additions
and
230 deletions
+230
-230
Lib/lib-old/ni.py
Lib/lib-old/ni.py
+186
-186
Lib/test/test_MimeWriter.py
Lib/test/test_MimeWriter.py
+44
-44
No files found.
Lib/lib-old/ni.py
View file @
068ad973
This diff is collapsed.
Click to expand it.
Lib/test/test_MimeWriter.py
View file @
068ad973
...
...
@@ -16,30 +16,30 @@ INTERFACE Seller-1;
TYPE Seller = OBJECT
DOCUMENTATION "A simple Seller interface to test ILU"
METHODS
price():INTEGER,
price():INTEGER,
END;
'''
BUYER
=
'''
\
class Buyer:
def __setup__(self, maxprice):
self._maxprice = maxprice
self._maxprice = maxprice
def __main__(self, kos):
"""Entry point upon arrival at a new KOS."""
broker = kos.broker()
# B4 == Barry's Big Bass Business :-)
seller = broker.lookup('Seller_1.Seller', 'B4')
if seller:
price = seller.price()
print 'Seller wants $', price, '... '
if price > self._maxprice:
print 'too much!'
else:
print "I'll take it!"
else:
print 'no seller found here'
'''
# Don't ask why this comment is here
"""Entry point upon arrival at a new KOS."""
broker = kos.broker()
# B4 == Barry's Big Bass Business :-)
seller = broker.lookup('Seller_1.Seller', 'B4')
if seller:
price = seller.price()
print 'Seller wants $', price, '... '
if price > self._maxprice:
print 'too much!'
else:
print "I'll take it!"
else:
print 'no seller found here'
'''
# Don't ask why this comment is here
STATE
=
'''
\
# instantiate a buyer instance and put it in a magic place for the KOS
...
...
@@ -49,32 +49,32 @@ __kp__.__setup__(500)
'''
SIMPLE_METADATA
=
[
(
"Interpreter"
,
"python"
),
(
"Interpreter-Version"
,
"1.3"
),
(
"Owner-Name"
,
"Barry Warsaw"
),
(
"Owner-Rendezvous"
,
"bwarsaw@cnri.reston.va.us"
),
(
"Home-KSS"
,
"kss.cnri.reston.va.us"
),
(
"Identifier"
,
"hdl://cnri.kss/my_first_knowbot"
),
(
"Launch-Date"
,
"Mon Feb 12 16:39:03 EST 1996"
),
]
(
"Interpreter"
,
"python"
),
(
"Interpreter-Version"
,
"1.3"
),
(
"Owner-Name"
,
"Barry Warsaw"
),
(
"Owner-Rendezvous"
,
"bwarsaw@cnri.reston.va.us"
),
(
"Home-KSS"
,
"kss.cnri.reston.va.us"
),
(
"Identifier"
,
"hdl://cnri.kss/my_first_knowbot"
),
(
"Launch-Date"
,
"Mon Feb 12 16:39:03 EST 1996"
),
]
COMPLEX_METADATA
=
[
(
"Metadata-Type"
,
"complex"
),
(
"Metadata-Key"
,
"connection"
),
(
"Access"
,
"read-only"
),
(
"Connection-Description"
,
"Barry's Big Bass Business"
),
(
"Connection-Id"
,
"B4"
),
(
"Connection-Direction"
,
"client"
),
]
(
"Metadata-Type"
,
"complex"
),
(
"Metadata-Key"
,
"connection"
),
(
"Access"
,
"read-only"
),
(
"Connection-Description"
,
"Barry's Big Bass Business"
),
(
"Connection-Id"
,
"B4"
),
(
"Connection-Direction"
,
"client"
),
]
EXTERNAL_METADATA
=
[
(
"Metadata-Type"
,
"complex"
),
(
"Metadata-Key"
,
"generic-interface"
),
(
"Access"
,
"read-only"
),
(
"Connection-Description"
,
"Generic Interface for All Knowbots"
),
(
"Connection-Id"
,
"generic-kp"
),
(
"Connection-Direction"
,
"client"
),
]
(
"Metadata-Type"
,
"complex"
),
(
"Metadata-Key"
,
"generic-interface"
),
(
"Access"
,
"read-only"
),
(
"Connection-Description"
,
"Generic Interface for All Knowbots"
),
(
"Connection-Id"
,
"generic-kp"
),
(
"Connection-Direction"
,
"client"
),
]
def
main
():
...
...
@@ -91,7 +91,7 @@ def main():
# Toplevel body parts
f
=
toplevel
.
startmultipartbody
(
"knowbot"
,
"801spam999"
,
[(
"version"
,
"0.1"
)],
prefix
=
0
)
[(
"version"
,
"0.1"
)],
prefix
=
0
)
f
.
write
(
"This is a multi-part message in MIME format.
\
n
"
)
# First toplevel body part: metadata
...
...
@@ -106,7 +106,7 @@ def main():
md1
.
addheader
(
"KP-Access"
,
"read-only"
)
m
=
MimeWriter
(
md1
.
startbody
(
"message/rfc822"
))
for
key
,
value
in
SIMPLE_METADATA
:
m
.
addheader
(
"KPMD-"
+
key
,
value
)
m
.
addheader
(
"KPMD-"
+
key
,
value
)
m
.
flushheaders
()
del
md1
...
...
@@ -114,7 +114,7 @@ def main():
md2
=
md
.
nextpart
()
for
key
,
value
in
COMPLEX_METADATA
:
md2
.
addheader
(
"KP-"
+
key
,
value
)
md2
.
addheader
(
"KP-"
+
key
,
value
)
f
=
md2
.
startbody
(
"text/isl"
)
f
.
write
(
SELLER
)
del
md2
...
...
@@ -123,11 +123,11 @@ def main():
md3
=
md
.
nextpart
()
f
=
md3
.
startbody
(
"message/external-body"
,
[(
"access-type"
,
"URL"
),
(
"URL"
,
"hdl://cnri.kss/generic-knowbot"
)])
[(
"access-type"
,
"URL"
),
(
"URL"
,
"hdl://cnri.kss/generic-knowbot"
)])
m
=
MimeWriter
(
f
)
for
key
,
value
in
EXTERNAL_METADATA
:
md3
.
addheader
(
"KP-"
+
key
,
value
)
md3
.
addheader
(
"KP-"
+
key
,
value
)
md3
.
startbody
(
"text/isl"
)
# Phantom body doesn't need to be written
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment