Skip to content

Commit e18ae56

Browse files
committed
docs: correct glob pattern examples in ScopeMeta documentation
1 parent 377c249 commit e18ae56

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

openedx_authz/api/data.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,11 @@ def __call__(cls, *args, **kwargs):
177177
1. external_key: Determines subclass from the key format. The namespace prefix
178178
before the first ':' is used to look up the appropriate subclass.
179179
Example: ScopeData(external_key='lib:DemoX:CSPROB') → ContentLibraryData
180-
Example: ScopeData(external_key='lib:DemoX*') → OrgLibraryGlobData
180+
Example: ScopeData(external_key='lib:DemoX:*') → OrgLibraryGlobData
181181
182182
2. namespaced_key: Determines subclass from the namespace prefix before '^'.
183183
Example: ScopeData(namespaced_key='lib^lib:DemoX:CSPROB') → ContentLibraryData
184-
Example: ScopeData(namespaced_key='lib^lib:DemoX*') → OrgLibraryGlobData
184+
Example: ScopeData(namespaced_key='lib^lib:DemoX:*') → OrgLibraryGlobData
185185
186186
Usage patterns:
187187
- namespaced_key: Used when retrieving objects from the policy store
@@ -193,7 +193,7 @@ def __call__(cls, *args, **kwargs):
193193
>>> isinstance(scope, ContentLibraryData)
194194
True
195195
>>> # From glob external key
196-
>>> scope = ScopeData(external_key='lib:DemoX*')
196+
>>> scope = ScopeData(external_key='lib:DemoX:*')
197197
>>> isinstance(scope, OrgLibraryGlobData)
198198
True
199199
>>> # From namespaced key (e.g., policy store)
@@ -230,7 +230,7 @@ def get_subclass_by_namespaced_key(mcs, namespaced_key: str) -> Type["ScopeData"
230230
If the key contains a wildcard, returns the appropriate glob subclass.
231231
232232
Args:
233-
namespaced_key: The namespaced key (e.g., 'lib^lib:DemoX:CSPROB', 'lib^lib:DemoX*', 'global^generic').
233+
namespaced_key: The namespaced key (e.g., 'lib^lib:DemoX:CSPROB', 'lib^lib:DemoX:*', 'global^generic').
234234
235235
Returns:
236236
The ScopeData subclass for the namespace, or ScopeData if namespace not recognized.
@@ -240,7 +240,9 @@ def get_subclass_by_namespaced_key(mcs, namespaced_key: str) -> Type["ScopeData"
240240
<class 'CourseOverviewData'>
241241
>>> ScopeMeta.get_subclass_by_namespaced_key('lib^lib:DemoX:CSPROB')
242242
<class 'ContentLibraryData'>
243-
>>> ScopeMeta.get_subclass_by_namespaced_key('lib^lib:DemoX*')
243+
>>> ScopeMeta.get_subclass_by_namespaced_key('course-v1^course-v1:WGU+*')
244+
<class 'OrgCourseGlobData'>
245+
>>> ScopeMeta.get_subclass_by_namespaced_key('lib^lib:DemoX:*')
244246
<class 'OrgLibraryGlobData'>
245247
>>> ScopeMeta.get_subclass_by_namespaced_key('global^generic')
246248
<class 'ScopeData'>
@@ -272,7 +274,7 @@ def get_subclass_by_external_key(mcs, external_key: str) -> Type["ScopeData"]:
272274
the appropriate glob subclass instead of the standard scope class.
273275
274276
Args:
275-
external_key: The external key (e.g., 'lib:DemoX:CSPROB', 'lib:DemoX*', 'global:generic').
277+
external_key: The external key (e.g., 'lib:DemoX:CSPROB', 'lib:DemoX:*', 'global:generic').
276278
277279
Returns:
278280
The ScopeData subclass corresponding to the namespace.
@@ -286,9 +288,9 @@ def get_subclass_by_external_key(mcs, external_key: str) -> Type["ScopeData"]:
286288
<class 'ContentLibraryData'>
287289
>>> ScopeMeta.get_subclass_by_external_key('course-v1:OpenedX+CS101+2024')
288290
<class 'CourseOverviewData'>
289-
>>> ScopeMeta.get_subclass_by_external_key('lib:DemoX*')
291+
>>> ScopeMeta.get_subclass_by_external_key('lib:DemoX:*')
290292
<class 'OrgLibraryGlobData'>
291-
>>> ScopeMeta.get_subclass_by_external_key('course-v1:OpenedX*')
293+
>>> ScopeMeta.get_subclass_by_external_key('course-v1:OpenedX+*')
292294
<class 'OrgCourseGlobData'>
293295
294296
Notes:
@@ -537,7 +539,7 @@ class OrgLibraryGlobData(ContentLibraryData):
537539
Attributes:
538540
NAMESPACE (str): Inherited 'lib' from ContentLibraryData.
539541
ID_SEPARATOR (str): ':' for content library scopes.
540-
IS_GLOB (bool): True for organization-level glob patterns.
542+
IS_GLOB (bool): True for scope data that represents a glob pattern.
541543
external_key (str): The glob pattern (e.g., ``lib:DemoX:*``).
542544
namespaced_key (str): The pattern with namespace (e.g., ``lib^lib:DemoX:*``).
543545
@@ -662,7 +664,6 @@ class CourseOverviewData(ScopeData):
662664
Attributes:
663665
NAMESPACE (str): 'course-v1' for course scopes.
664666
ID_SEPARATOR (str): '+' for course scopes.
665-
IS_GLOB (bool): False for course scopes.
666667
external_key (str): The course identifier (e.g., 'course-v1:TestOrg+TestCourse+2024_T1').
667668
Must be a valid CourseKey format.
668669
namespaced_key (str): The course identifier with namespace
@@ -771,7 +772,7 @@ class OrgCourseGlobData(CourseOverviewData):
771772
Attributes:
772773
NAMESPACE (str): Inherited 'course-v1' from CourseOverviewData.
773774
ID_SEPARATOR (str): '+' for course scopes.
774-
IS_GLOB (bool): True for organization-level glob patterns.
775+
IS_GLOB (bool): True for scope data that represents a glob pattern.
775776
external_key (str): The glob pattern (e.g., 'course-v1:OpenedX+*').
776777
namespaced_key (str): The pattern with namespace (e.g., 'course-v1^course-v1:OpenedX+*').
777778

0 commit comments

Comments
 (0)