After lots of discussions, default commands where moved from game/gamesrc/commands/default to src/commands/default in order to make it clearer which parts are updated as part of evennia and which can be tweaked at heart's content. New templates where left in gamesrc/commands that should hopefully make it clearer how to extend the command system. Also game/web was moved to src/web - we'll likely extend this from game/gamesrc/web in the future. If you already did extensions you should just have to edit your import paths and make use of the new cmdset template supplied.
The unit testing was for commands was split out from src/objects/tests.py into the new src/commands/default/test.py in order to keep the testing modules thematically grouped with the things they are testing.
This commit is contained in:
parent
a3917073ff
commit
72d40285b8
61 changed files with 381 additions and 184 deletions
0
src/web/website/__init__.py
Normal file
0
src/web/website/__init__.py
Normal file
7
src/web/website/models.py
Normal file
7
src/web/website/models.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#
|
||||
# Define database entities for the app.
|
||||
#
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
10
src/web/website/urls.py
Normal file
10
src/web/website/urls.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"""
|
||||
This structures the (simple) structure of the
|
||||
webpage 'application'.
|
||||
"""
|
||||
|
||||
from django.conf.urls.defaults import *
|
||||
|
||||
urlpatterns = patterns('src.web.website.views',
|
||||
(r'^$', 'page_index'),
|
||||
)
|
||||
63
src/web/website/views.py
Normal file
63
src/web/website/views.py
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.contrib.auth.models import User
|
||||
from django.conf import settings
|
||||
|
||||
from src.config.models import ConfigValue
|
||||
from src.objects.models import ObjectDB
|
||||
from src.typeclasses.models import TypedObject
|
||||
from src.players.models import PlayerDB
|
||||
from src.web.news.models import NewsEntry
|
||||
|
||||
"""
|
||||
This file contains the generic, assorted views that don't fall under one of
|
||||
the other applications.
|
||||
"""
|
||||
|
||||
def page_index(request):
|
||||
"""
|
||||
Main root page.
|
||||
"""
|
||||
# Some misc. configurable stuff.
|
||||
# TODO: Move this to either SQL or settings.py based configuration.
|
||||
fpage_player_limit = 4
|
||||
fpage_news_entries = 2
|
||||
|
||||
# A QuerySet of recent news entries.
|
||||
news_entries = NewsEntry.objects.all().order_by('-date_posted')[:fpage_news_entries]
|
||||
# A QuerySet of the most recently connected players.
|
||||
recent_users = PlayerDB.objects.get_recently_connected_players()[:fpage_player_limit]
|
||||
|
||||
exits = ObjectDB.objects.get_objs_with_attr('_destination')
|
||||
rooms = [room for room in ObjectDB.objects.filter(db_home=None) if room not in exits]
|
||||
|
||||
pagevars = {
|
||||
"page_title": "Front Page",
|
||||
"news_entries": news_entries,
|
||||
"players_connected_recent": recent_users,
|
||||
"num_players_connected": ConfigValue.objects.conf('nr_sessions'),#len(PlayerDB.objects.get_connected_players()),
|
||||
"num_players_registered": PlayerDB.objects.num_total_players(),
|
||||
"num_players_connected_recent": len(PlayerDB.objects.get_recently_connected_players()),
|
||||
"num_players_registered_recent": len(PlayerDB.objects.get_recently_created_players()),
|
||||
"num_rooms": len(rooms),
|
||||
"num_exits": len(exits),
|
||||
"num_objects" : ObjectDB.objects.all().count()
|
||||
}
|
||||
|
||||
context_instance = RequestContext(request)
|
||||
return render_to_response('index.html', pagevars, context_instance)
|
||||
|
||||
def to_be_implemented(request):
|
||||
"""
|
||||
A notice letting the user know that this particular feature hasn't been
|
||||
implemented yet.
|
||||
"""
|
||||
|
||||
pagevars = {
|
||||
"page_title": "To Be Implemented...",
|
||||
}
|
||||
|
||||
context_instance = RequestContext(request)
|
||||
return render_to_response('tbi.html', pagevars, context_instance)
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue