Created wrappers for creating Tags.
This commit is contained in:
parent
f4c9c18a66
commit
72bdc3b37f
2 changed files with 22 additions and 2 deletions
10
ev.py
10
ev.py
|
|
@ -144,6 +144,7 @@ from src.scripts.scripts import Script
|
||||||
|
|
||||||
# comms
|
# comms
|
||||||
from src.comms.models import Msg, ChannelDB, PlayerChannelConnection, ExternalChannelConnection
|
from src.comms.models import Msg, ChannelDB, PlayerChannelConnection, ExternalChannelConnection
|
||||||
|
from src.comms.comms import Channel
|
||||||
|
|
||||||
# objects
|
# objects
|
||||||
from src.objects.objects import Object, Character, Room, Exit
|
from src.objects.objects import Object, Character, Room, Exit
|
||||||
|
|
@ -210,8 +211,10 @@ class DBmanagers(_EvContainer):
|
||||||
from src.comms.models import Msg, ChannelDB, PlayerChannelConnection, ExternalChannelConnection
|
from src.comms.models import Msg, ChannelDB, PlayerChannelConnection, ExternalChannelConnection
|
||||||
from src.objects.models import ObjectDB
|
from src.objects.models import ObjectDB
|
||||||
from src.server.models import ServerConfig
|
from src.server.models import ServerConfig
|
||||||
|
from src.typeclasses.models import Tag, Attribute
|
||||||
|
|
||||||
helpentry = HelpEntry.objects
|
# create container's properties
|
||||||
|
helpentries = HelpEntry.objects
|
||||||
players = PlayerDB.objects
|
players = PlayerDB.objects
|
||||||
scripts = ScriptDB.objects
|
scripts = ScriptDB.objects
|
||||||
msgs = Msg.objects
|
msgs = Msg.objects
|
||||||
|
|
@ -220,8 +223,11 @@ class DBmanagers(_EvContainer):
|
||||||
externalconnections = ExternalChannelConnection.objects
|
externalconnections = ExternalChannelConnection.objects
|
||||||
objects = ObjectDB.objects
|
objects = ObjectDB.objects
|
||||||
serverconfigs = ServerConfig.objects
|
serverconfigs = ServerConfig.objects
|
||||||
|
attributes = Attribute.objects
|
||||||
|
tags = Tag.objects
|
||||||
|
# remove these so they are not visible as properties
|
||||||
del HelpEntry, PlayerDB, ScriptDB, Msg, ChannelDB, PlayerChannelConnection,
|
del HelpEntry, PlayerDB, ScriptDB, Msg, ChannelDB, PlayerChannelConnection,
|
||||||
del ExternalChannelConnection, ObjectDB, ServerConfig
|
del ExternalChannelConnection, ObjectDB, ServerConfig, Tags, Attributes
|
||||||
|
|
||||||
managers = DBmanagers()
|
managers = DBmanagers()
|
||||||
del DBmanagers
|
del DBmanagers
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ _PlayerDB = None
|
||||||
_to_object = None
|
_to_object = None
|
||||||
_ChannelDB = None
|
_ChannelDB = None
|
||||||
_channelhandler = None
|
_channelhandler = None
|
||||||
|
_Tag = None
|
||||||
|
|
||||||
|
|
||||||
# limit symbol import from API
|
# limit symbol import from API
|
||||||
|
|
@ -398,6 +399,19 @@ def create_channel(key, aliases=None, desc=None,
|
||||||
channel = create_channel
|
channel = create_channel
|
||||||
|
|
||||||
|
|
||||||
|
def create_tag(self, key=None, category=None, data=None):
|
||||||
|
"""
|
||||||
|
Create a tag. This makes sure to create case-insensitive tags.
|
||||||
|
Note that if the exact same tag configuration (key+category)
|
||||||
|
exists, it will be re-used. A data keyword will overwrite existing
|
||||||
|
data on a tag (it is not part of what makes the tag unique).
|
||||||
|
"""
|
||||||
|
global _Tag
|
||||||
|
if not _Tag:
|
||||||
|
from src.typeclasses.models import Tag as _Tag
|
||||||
|
return _Tag.objects.create_tag(key=key, category=category, data=data)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Player creation methods
|
# Player creation methods
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue