Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
ZKAPAuthorizer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Administrator
ZKAPAuthorizer
Commits
ca554f62
Commit
ca554f62
authored
3 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
Make a safer way to check if an interface has an attribute
parent
1f3558da
No related branches found
No related tags found
2 merge requests
!231
Remove `renew_lease` from our storage protocol
,
!229
Set up CI for Tahoe 1.16.x
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/_zkapauthorizer/foolscap.py
+15
-1
15 additions, 1 deletion
src/_zkapauthorizer/foolscap.py
with
15 additions
and
1 deletion
src/_zkapauthorizer/foolscap.py
+
15
−
1
View file @
ca554f62
...
@@ -141,6 +141,20 @@ def add_arguments(schema, kwargs):
...
@@ -141,6 +141,20 @@ def add_arguments(schema, kwargs):
return
modified_schema
return
modified_schema
def
remoteinterface_hasattr
(
ri
,
name
):
"""
:param InterfaceClass ri: A ``RemoteInterface`` to inspect.
:param str name: The name of an attribute.
:return bool: ``True`` if and only if ``ri`` has the attribute named by
``name``, ``False`` otherwise.
"""
try
:
ri
[
name
]
except
KeyError
:
return
False
return
True
class
RIPrivacyPassAuthorizedStorageServer
(
RemoteInterface
):
class
RIPrivacyPassAuthorizedStorageServer
(
RemoteInterface
):
"""
"""
...
@@ -162,7 +176,7 @@ class RIPrivacyPassAuthorizedStorageServer(RemoteInterface):
...
@@ -162,7 +176,7 @@ class RIPrivacyPassAuthorizedStorageServer(RemoteInterface):
add_lease
=
add_passes
(
RIStorageServer
[
"
add_lease
"
])
add_lease
=
add_passes
(
RIStorageServer
[
"
add_lease
"
])
if
"
re
new_lease
"
in
RIStorageServer
:
if
re
moteinterface_hasattr
(
RIStorageServer
,
"
renew_lease
"
)
:
# Tahoe-LAFS 1.16.0 drops renew_lease from the interface. Do likewise
# Tahoe-LAFS 1.16.0 drops renew_lease from the interface. Do likewise
# here, if we discover we have a version of Tahoe that has done so.
# here, if we discover we have a version of Tahoe that has done so.
# If Tahoe has dropped this method then nothing in Tahoe is going to
# If Tahoe has dropped this method then nothing in Tahoe is going to
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment