Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Nicolas Wavrant
ZODB
Commits
532f04c5
Commit
532f04c5
authored
Jan 20, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factory:
- remove methods that aren't needed - rename "resolved" to "instance" for readability
parent
3131a89b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
19 deletions
+10
-19
src/zLOG/factory.py
src/zLOG/factory.py
+10
-19
No files found.
src/zLOG/factory.py
View file @
532f04c5
##############################################################################
##############################################################################
#
#
# Copyright (c) 2002
, 2003
Zope Corporation and Contributors.
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# All Rights Reserved.
#
#
# This software is subject to the provisions of the Zope Public License,
# This software is subject to the provisions of the Zope Public License,
...
@@ -41,27 +41,18 @@ class Factory:
...
@@ -41,27 +41,18 @@ class Factory:
def
__init__
(
self
,
class_path
,
callback
,
*
args
,
**
kw
):
def
__init__
(
self
,
class_path
,
callback
,
*
args
,
**
kw
):
self
.
class_path
=
class_path
self
.
class_path
=
class_path
self
.
callback
=
callback
self
.
callback
=
callback
self
.
setArgs
(
list
(
args
),
kw
)
self
.
args
=
args
self
.
resolved
=
_marker
self
.
kw
=
kw
self
.
instance
=
_marker
def
__repr__
(
self
):
def
__repr__
(
self
):
return
(
'<Factory instance for class "%s" with positional args "%s" '
return
(
'<Factory instance for class "%s" with positional args "%s" '
'and keword args "%s"'
%
(
self
.
class_path
,
self
.
args
,
self
.
kw
))
'and keword args "%s"'
%
(
self
.
class_path
,
self
.
args
,
self
.
kw
))
__str__
=
__repr__
def
__call__
(
self
):
def
__call__
(
self
):
if
self
.
resolved
is
_marker
:
if
self
.
instance
is
_marker
:
package
=
importer
(
self
.
class_path
)
constructor
=
importer
(
self
.
class_path
)
inst
=
package
(
*
self
.
args
,
**
self
.
kw
)
self
.
instance
=
constructor
(
*
self
.
args
,
**
self
.
kw
)
if
self
.
callback
:
if
self
.
callback
is
not
None
:
self
.
callback
(
inst
)
self
.
callback
(
self
.
instance
)
self
.
resolved
=
inst
return
self
.
instance
return
self
.
resolved
def
setArgs
(
self
,
args
,
kw
):
self
.
args
=
args
self
.
kw
=
kw
def
getArgs
(
self
):
return
(
self
.
args
,
self
.
kw
)
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