launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27748
[Merge] ~cjwatson/launchpad:remove-dbschemaapi into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:remove-dbschemaapi into launchpad:master.
Commit message:
Remove deprecated DBSchemaAPI TALES adapter
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/412125
This was deprecated long ago and is no longer used (difficult to search for, but confirmed by a full test run).
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-dbschemaapi into launchpad:master.
diff --git a/lib/lp/app/browser/configure.zcml b/lib/lp/app/browser/configure.zcml
index 753ce04..2fc4e64 100644
--- a/lib/lp/app/browser/configure.zcml
+++ b/lib/lp/app/browser/configure.zcml
@@ -635,13 +635,6 @@
/>
<adapter
- for="int"
- provides="zope.traversing.interfaces.IPathAdapter"
- factory="lp.app.browser.tales.DBSchemaAPI"
- name="lp"
- />
-
- <adapter
for="datetime.datetime"
provides="zope.traversing.interfaces.IPathAdapter"
factory="lp.app.browser.tales.DateTimeFormatterAPI"
diff --git a/lib/lp/app/browser/tales.py b/lib/lp/app/browser/tales.py
index 51239bb..1b42eb7 100644
--- a/lib/lp/app/browser/tales.py
+++ b/lib/lp/app/browser/tales.py
@@ -17,7 +17,6 @@ import os.path
import sys
from textwrap import dedent
-from lazr.enum import enumerated_type_registry
from lazr.restful.utils import get_current_browser_request
from lazr.uri import URI
import pytz
@@ -467,23 +466,6 @@ class RequestAPI:
return params
-@implementer(ITraversable)
-class DBSchemaAPI:
- """Adapter from integers to things that can extract information from
- DBSchemas.
- """
-
- def __init__(self, number):
- self._number = number
-
- def traverse(self, name, furtherPath):
- if name in enumerated_type_registry:
- enum = enumerated_type_registry[name]
- return enum.items[self._number].title
- else:
- raise TraversalError(name)
-
-
# Python 3 doesn't have types.NoneType, but we still need to be able to
# refer to the type of None from ZCML so that we can register the
# NoneFormatter adapter.
diff --git a/lib/lp/app/doc/tales.txt b/lib/lp/app/doc/tales.txt
index e68f86d..dc5a24c 100644
--- a/lib/lp/app/doc/tales.txt
+++ b/lib/lp/app/doc/tales.txt
@@ -1359,21 +1359,6 @@ with 'None/fmt:foo'.
''
-The lp: namespace for presenting DBSchema items
------------------------------------------------
-
-This is deprecated, and should raise a deprecation warning in the
-future, and eventually be removed. It is no longer needed, now that we
-have an EnumCol for sqlobject.
-
-Test the 'lp:' namespace for presenting DBSchema items.
-
- >>> from lp.soyuz.enums import BinaryPackageFormat
- >>> deb = BinaryPackageFormat.DEB.value
- >>> test_tales('deb/lp:BinaryPackageFormat', deb=deb)
- 'Ubuntu Package'
-
-
The someobject/required:some.Permission helper
----------------------------------------------
@@ -1405,6 +1390,7 @@ template matches a particular valid value for that DBSchema enum.
This was going to be called 'enum-value', but Zope doesn't allow this.
To be fixed upstream.
+ >>> from lp.soyuz.enums import BinaryPackageFormat
>>> deb = BinaryPackageFormat.DEB
>>> udeb = BinaryPackageFormat.UDEB
>>> test_tales('deb/enumvalue:DEB', deb=deb)
diff --git a/lib/lp/app/tests/test_tales.py b/lib/lp/app/tests/test_tales.py
index 73a8464..72c47ca 100644
--- a/lib/lp/app/tests/test_tales.py
+++ b/lib/lp/app/tests/test_tales.py
@@ -110,34 +110,6 @@ def test_cookie_scope():
"""
-def test_dbschemaapi():
- """
- >>> from lp.app.browser.tales import DBSchemaAPI
- >>> from lp.code.enums import BranchType
-
- The syntax to get the title is: number/lp:DBSchemaClass
-
- >>> (str(DBSchemaAPI(1).traverse('BranchType', []))
- ... == BranchType.HOSTED.title)
- True
-
- Using an inappropriate number should give a KeyError.
-
- >>> DBSchemaAPI(99).traverse('BranchType', [])
- Traceback (most recent call last):
- ...
- KeyError: 99
-
- Using a dbschema name that doesn't exist should give a LocationError
-
- >>> DBSchemaAPI(99).traverse('NotADBSchema', [])
- Traceback (most recent call last):
- ...
- LocationError: 'NotADBSchema'
-
- """
-
-
class TestPersonFormatterAPI(TestCaseWithFactory):
"""Tests for PersonFormatterAPI"""