evennia.help package¶
This sub-package defines the help system of Evennia. It is pretty simple, mainly consisting of a database model to hold help entries. The auto-cmd-help is rather handled by the default ‘help’ command itself.
Subpackages¶
Submodules¶
evennia.help.admin module¶
This defines how to edit help entries in Admin.
-
class
evennia.help.admin.HelpEntryAdmin(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdminSets up the admin manaager for help entries
-
fieldsets= ((None, {'fields': (('db_key', 'db_help_category'), 'db_entrytext', 'db_lock_storage'), 'description': 'Sets a Help entry. Set lock to <i>view:all()</I> unless you want to restrict it.'}),)¶
-
form¶ alias of
HelpEntryForm
-
inlines= [<class 'evennia.help.admin.HelpTagInline'>]¶
-
list_display= ('id', 'db_key', 'db_help_category', 'db_lock_storage')¶
-
list_display_links= ('id', 'db_key')¶
-
property
media¶
-
ordering= ['db_help_category', 'db_key']¶
-
save_as= True¶
-
save_on_top= True¶
-
search_fields= ['^db_key', 'db_entrytext']¶
-
-
class
evennia.help.admin.HelpEntryForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.models.ModelFormDefines how to display the help entry
-
class
Meta[source]¶ Bases:
object-
fields= '__all__'¶
-
model¶ alias of
evennia.help.models.HelpEntry
-
-
_meta= <django.forms.models.ModelFormOptions object>¶
-
base_fields= {'db_entrytext': <django.forms.fields.CharField object>, 'db_help_category': <django.forms.fields.CharField object>, 'db_key': <django.forms.fields.CharField object>, 'db_lock_storage': <django.forms.fields.CharField object>, 'db_staff_only': <django.forms.fields.BooleanField object>, 'db_tags': <django.forms.models.ModelMultipleChoiceField object>}¶
-
declared_fields= {'db_help_category': <django.forms.fields.CharField object>, 'db_lock_storage': <django.forms.fields.CharField object>}¶
-
property
media¶
-
class
-
class
evennia.help.admin.HelpTagInline(parent_model, admin_site)[source]¶ Bases:
evennia.typeclasses.admin.TagInline-
property
media¶
-
model¶ alias of
evennia.help.models.HelpEntry_db_tags
-
property
evennia.help.manager module¶
Custom manager for HelpEntry objects.
-
class
evennia.help.manager.HelpEntryManager[source]¶ Bases:
evennia.typeclasses.managers.TypedObjectManagerThis HelpEntryManager implements methods for searching and manipulating HelpEntries directly from the database.
These methods will all return database objects (or QuerySets) directly.
Evennia-specific: find_topicmatch find_apropos find_topicsuggestions find_topics_with_category all_to_category search_help (equivalent to evennia.search_helpentry)
-
all_to_category(default_category)[source]¶ Shifts all help entries in database to default_category. This action cannot be reverted. It is used primarily by the engine when importing a default help database, making sure this ends up in one easily separated category.
- Parameters
default_category (str) – Category to move entries to.
-
find_apropos(topicstr)[source]¶ Do a very loose search, returning all help entries containing the search criterion in their titles.
- Parameters
topicstr (str) – Search criterion.
- Returns
Query results.
- Return type
matches (HelpEntries)
-
find_topicmatch(topicstr, exact=False)[source]¶ Searches for matching topics or aliases based on player’s input.
- Parameters
topcistr (str) – Help topic to search for.
exact (bool, optional) – Require exact match (non-case-sensitive). If False (default), match sub-parts of the string.
- Returns
Query results.
- Return type
matches (HelpEntries)
-
find_topics_with_category(help_category)[source]¶ Search topics having a particular category.
- Parameters
help_category (str) – Category query criterion.
- Returns
Query results.
- Return type
matches (HelpEntries)
-
find_topicsuggestions(topicstr)[source]¶ Do a fuzzy match, preferably within the category of the current topic.
- Parameters
topicstr (str) – Search criterion.
- Returns
Query results.
- Return type
matches (Helpentries)
-
evennia.help.models module¶
Models for the help system.
The database-tied help system is only half of Evennia’s help functionality, the other one being the auto-generated command help that is created on the fly from each command’s __doc__ string. The persistent database system defined here is intended for all other forms of help that do not concern commands, like information about the game world, policy info, rules and similar.
-
class
evennia.help.models.HelpEntry(*args, **kwargs)[source]¶ Bases:
evennia.utils.idmapper.models.SharedMemoryModelA generic help entry.
- An HelpEntry object has the following properties defined:
key - main name of entry help_category - which category entry belongs to (defaults to General) entrytext - the actual help text permissions - perm strings
- Method:
access
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
_is_deleted= False¶
-
_meta= <Options for HelpEntry>¶
-
access(accessing_obj, access_type='read', default=False)[source]¶ Determines if another object has permission to access. accessing_obj - object trying to access this one access_type - type of access sought default - what to return if no lock of access_type was found
-
db_entrytext¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
db_help_category¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
db_key¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
db_lock_storage¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
db_staff_only¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
-
property
entrytext¶ A wrapper for getting database field db_entrytext.
-
get_absolute_url()¶ Returns the URI path for a View that allows users to view details for this object.
ex. Oscar (Character) = ‘/characters/oscar/1/’
For this to work, the developer must have defined a named view somewhere in urls.py that follows the format ‘modelname-action’, so in this case a named view of ‘character-detail’ would be referenced by this method.
ex. url(r’characters/(?P<slug>[wd-]+)/(?P<pk>[0-9]+)/$’,
CharDetailView.as_view(), name=’character-detail’)
If no View has been created and defined in urls.py, returns an HTML anchor.
This method is naive and simply returns a path. Securing access to the actual view and limiting who can view this object is the developer’s responsibility.
- Returns
URI path to object detail page, if defined.
- Return type
path (str)
-
property
help_category¶ A wrapper for getting database field db_help_category.
-
id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
property
key¶ A wrapper for getting database field db_key.
-
property
lock_storage¶ A wrapper for getting database field db_lock_storage.
-
objects= <evennia.help.manager.HelpEntryManager object>¶
-
path= 'evennia.help.models.HelpEntry'¶
-
property
search_index_entry¶ Property for easily retaining a search index entry for this object.
-
property
staff_only¶ A wrapper for getting database field db_staff_only.
-
typename= 'SharedMemoryModelBase'¶
-
web_get_admin_url()[source]¶ Returns the URI path for the Django Admin page for this object.
ex. Account#1 = ‘/admin/accounts/accountdb/1/change/’
- Returns
URI path to Django Admin page for object.
- Return type
path (str)
-
classmethod
web_get_create_url()[source]¶ Returns the URI path for a View that allows users to create new instances of this object.
ex. Chargen = ‘/characters/create/’
For this to work, the developer must have defined a named view somewhere in urls.py that follows the format ‘modelname-action’, so in this case a named view of ‘character-create’ would be referenced by this method.
ex. url(r’characters/create/’, ChargenView.as_view(), name=’character-create’)
If no View has been created and defined in urls.py, returns an HTML anchor.
This method is naive and simply returns a path. Securing access to the actual view and limiting who can create new objects is the developer’s responsibility.
- Returns
URI path to object creation page, if defined.
- Return type
path (str)
-
web_get_delete_url()[source]¶ Returns the URI path for a View that allows users to delete this object.
ex. Oscar (Character) = ‘/characters/oscar/1/delete/’
For this to work, the developer must have defined a named view somewhere in urls.py that follows the format ‘modelname-action’, so in this case a named view of ‘character-detail’ would be referenced by this method.
ex. url(r’characters/(?P<slug>[wd-]+)/(?P<pk>[0-9]+)/delete/$’,
CharDeleteView.as_view(), name=’character-delete’)
If no View has been created and defined in urls.py, returns an HTML anchor.
This method is naive and simply returns a path. Securing access to the actual view and limiting who can delete this object is the developer’s responsibility.
- Returns
URI path to object deletion page, if defined.
- Return type
path (str)
-
web_get_detail_url()[source]¶ Returns the URI path for a View that allows users to view details for this object.
ex. Oscar (Character) = ‘/characters/oscar/1/’
For this to work, the developer must have defined a named view somewhere in urls.py that follows the format ‘modelname-action’, so in this case a named view of ‘character-detail’ would be referenced by this method.
ex. url(r’characters/(?P<slug>[wd-]+)/(?P<pk>[0-9]+)/$’,
CharDetailView.as_view(), name=’character-detail’)
If no View has been created and defined in urls.py, returns an HTML anchor.
This method is naive and simply returns a path. Securing access to the actual view and limiting who can view this object is the developer’s responsibility.
- Returns
URI path to object detail page, if defined.
- Return type
path (str)
-
web_get_update_url()[source]¶ Returns the URI path for a View that allows users to update this object.
ex. Oscar (Character) = ‘/characters/oscar/1/change/’
For this to work, the developer must have defined a named view somewhere in urls.py that follows the format ‘modelname-action’, so in this case a named view of ‘character-update’ would be referenced by this method.
ex. url(r’characters/(?P<slug>[wd-]+)/(?P<pk>[0-9]+)/change/$’,
CharUpdateView.as_view(), name=’character-update’)
If no View has been created and defined in urls.py, returns an HTML anchor.
This method is naive and simply returns a path. Securing access to the actual view and limiting who can modify objects is the developer’s responsibility.
- Returns
URI path to object update page, if defined.
- Return type
path (str)