Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
0651b478
Commit
0651b478
authored
Oct 09, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added optimization to cache result classes.
parent
e08b9f21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
lib/python/Shared/DC/ZRDB/RDB.py
lib/python/Shared/DC/ZRDB/RDB.py
+18
-6
No files found.
lib/python/Shared/DC/ZRDB/RDB.py
View file @
0651b478
...
...
@@ -11,8 +11,8 @@
__doc__
=
'''Class for reading RDB files
$Id: RDB.py,v 1.
6 1997/09/30 16:41:06
jim Exp $'''
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
$Id: RDB.py,v 1.
7 1997/10/09 15:11:12
jim Exp $'''
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
import
regex
,
regsub
from
string
import
split
,
strip
,
lower
,
atof
,
atoi
,
atol
...
...
@@ -27,6 +27,9 @@ Parsers={'n': atof,
'd'
:
DateTime
.
DateTime
,
}
record_classes
=
{}
class
File
:
"""Class for reading RDB files
"""
...
...
@@ -99,10 +102,16 @@ class File:
i=i+1
# Create a record class to hold the records.
class r(Record): pass
r.__record_schema__=schema
for k in filter(lambda k: k[:2]=='
__
', Record.__dict__.keys()):
setattr(r,k,getattr(Record,k))
names=tuple(names)
if record_classes.has_key(names):
r=record_classes[names]
else:
class r(Record): pass
r.__record_schema__=schema
for k in filter(lambda k: k[:2]=='
__
', Record.__dict__.keys()):
setattr(r,k,getattr(Record,k))
record_classes[names]=r
self._class=r
# OK, we'
ve
read
meta
data
,
now
get
line
indexes
...
...
@@ -159,6 +168,9 @@ class File:
##############################################################################
#
# $Log: RDB.py,v $
# Revision 1.7 1997/10/09 15:11:12 jim
# Added optimization to cache result classes.
#
# Revision 1.6 1997/09/30 16:41:06 jim
# Fixed bug in handling empty lines.
#
...
...
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