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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
Show 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.
#
# This software is subject to the provisions of the Zope Public License,
...
...
@@ -41,27 +41,18 @@ class Factory:
def
__init__
(
self
,
class_path
,
callback
,
*
args
,
**
kw
):
self
.
class_path
=
class_path
self
.
callback
=
callback
self
.
setArgs
(
list
(
args
),
kw
)
self
.
resolved
=
_marker
self
.
args
=
args
self
.
kw
=
kw
self
.
instance
=
_marker
def
__repr__
(
self
):
return
(
'<Factory instance for class "%s" with positional args "%s" '
'and keword args "%s"'
%
(
self
.
class_path
,
self
.
args
,
self
.
kw
))
__str__
=
__repr__
def
__call__
(
self
):
if
self
.
resolved
is
_marker
:
package
=
importer
(
self
.
class_path
)
inst
=
package
(
*
self
.
args
,
**
self
.
kw
)
if
self
.
callback
:
self
.
callback
(
inst
)
self
.
resolved
=
inst
return
self
.
resolved
def
setArgs
(
self
,
args
,
kw
):
self
.
args
=
args
self
.
kw
=
kw
def
getArgs
(
self
):
return
(
self
.
args
,
self
.
kw
)
if
self
.
instance
is
_marker
:
constructor
=
importer
(
self
.
class_path
)
self
.
instance
=
constructor
(
*
self
.
args
,
**
self
.
kw
)
if
self
.
callback
is
not
None
:
self
.
callback
(
self
.
instance
)
return
self
.
instance
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