File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 1515class WorkboxName (str ):
1616 """The joined name of a workbox `group/workbox` with access to its parts.
1717
18+ You may pass the group, workbox, or the fully formed workbox name:
19+ examples:
20+ workboxName = WorkboxName("Group01", "Workbox05")
21+ workboxName = WorkboxName("Group01/Workbox05")
1822 This subclass provides properties for the group and workbox values separately.
1923 """
2024
21- def __new__ (cls , group , workbox ):
22- txt = "/" .join ((group , workbox ))
25+ def __new__ (cls , name , sub_name = None ):
26+ if sub_name is not None :
27+ txt = "/" .join ((name , sub_name ))
28+ else :
29+ txt = name
30+ try :
31+ name , sub_name = txt .split ("/" )
32+ except ValueError :
33+ msg = "A fully formed name, or a group and name, must be passed in."
34+ raise ValueError (msg ) from None
35+
2336 ret = super ().__new__ (cls , txt )
2437 # Preserve the imitable nature of str's by using properties without setters.
25- ret ._group = group
26- ret ._workbox = workbox
38+ ret ._group = name
39+ ret ._workbox = sub_name
2740 return ret
2841
2942 @property
You can’t perform that action at this time.
0 commit comments