evennia.web.website.views.help¶
Views to manipulate help entries.
- Multi entry object type supported added by DaveWithTheNiceHat 2021
Pull Request #2429
-
evennia.web.website.views.help.
get_help_category
(help_entry, slugify_cat=True)[源代码]¶ Returns help category.
- 参数
help_entry (HelpEntry, FileHelpEntry or Command) – Help entry instance.
slugify_cat (bool) – If true the return string is slugified. Default is True.
提示
If an entry does not have a help_category attribute, DEFAULT_HELP_CATEGORY from the settings file is used. If the entry does not have attribute ‘web_help_entries’. One is created with a slugified copy of the attribute help_category. This attribute is used for sorting the entries for the help index (ListView) page.
- 返回
help_category (str) – The category for the help entry.
-
evennia.web.website.views.help.
get_help_topic
(help_entry)[源代码]¶ Get the topic of the help entry.
- 参数
help_entry (HelpEntry, FileHelpEntry or Command) – Help entry instance.
- 返回
help_topic (str) – The topic of the help entry. Default is ‘unknown_topic’.
-
evennia.web.website.views.help.
can_read_topic
(cmd_or_topic, account)[源代码]¶ Check if an account or puppet has read access to a help entry.
- 参数
cmd_or_topic (Command, HelpEntry or FileHelpEntry) – The topic/command to test.
account – the account or puppet checking for access.
- 返回
bool – If command can be viewed or not.
提示
This uses the ‘read’ lock. If no ‘read’ lock is defined, the topic is assumed readable by all. Even if this returns False, the entry will still be visible in the help index unless can_list_topic is also returning False.
-
evennia.web.website.views.help.
collect_topics
(account)[源代码]¶ Collect help topics from all sources (cmd/db/file).
- 参数
account (Character or Account) – Account or Character to collect help topics from.
- 返回
cmd_help_topics (dict) – contains Command instances. db_help_topics (dict): contains HelpEntry instances. file_help_topics (dict): contains FileHelpEntry instances
-
class
evennia.web.website.views.help.
HelpMixin
[源代码]¶ 基类:
object
This is a “mixin”, a modifier of sorts.
Any view class with this in its inheritance list will be modified to work with HelpEntry objects instead of generic Objects or otherwise.
-
page_title
= 'Help'¶
-
-
class
evennia.web.website.views.help.
HelpListView
(**kwargs)[源代码]¶ 基类:
evennia.web.website.views.help.HelpMixin
,django.views.generic.list.ListView
Returns a list of help entries that can be viewed by a user, authenticated or not.
-
paginate_by
= 500¶
-
template_name
= 'website/help_list.html'¶
-
page_title
= 'Help Index'¶
-
-
class
evennia.web.website.views.help.
HelpDetailView
(**kwargs)[源代码]¶ 基类:
evennia.web.website.views.help.HelpMixin
,django.views.generic.detail.DetailView
Returns the detail page for a given help entry.
-
template_name
= 'website/help_detail.html'¶
-
property
page_title
¶ str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
-