From 0adfd4d45c4fd8eebfa0e03e82a66b9eb0f520dd Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Mon, 1 Jan 2007 23:38:59 +0000 Subject: [PATCH] Finally found and fixed the problem with editing objects in the admin interface. --- evennia/trunk/apps/objects/models.py | 12 +++++----- evennia/trunk/commands_general.py | 10 +++++++-- .../{global_defines.py => defines_global.py} | 0 evennia/trunk/evennia.sql | Bin 48128 -> 48128 bytes evennia/trunk/functions_db.py | 2 +- evennia/trunk/functions_help.py | 21 +++++++++++++----- evennia/trunk/prepenv.sh | 4 ++-- evennia/trunk/server.py | 4 ++-- 8 files changed, 35 insertions(+), 18 deletions(-) rename evennia/trunk/{global_defines.py => defines_global.py} (100%) mode change 100644 => 100755 diff --git a/evennia/trunk/apps/objects/models.py b/evennia/trunk/apps/objects/models.py index 27ef5e6ae7..3c17f36141 100755 --- a/evennia/trunk/apps/objects/models.py +++ b/evennia/trunk/apps/objects/models.py @@ -1,7 +1,7 @@ from django.db import models from django.contrib.auth.models import User -import global_defines -import ansi +import evennia.defines_global as global_defines +import evennia.ansi class Attribute(models.Model): """ @@ -21,7 +21,7 @@ class Attribute(models.Model): return "%s(%d)" % (self.name, self.id,) class Admin: - list_display = ('name', 'value',) + list_display = ('object', 'name', 'value',) class Object(models.Model): """ @@ -57,7 +57,7 @@ class Object(models.Model): ) class Admin: - list_display = ('name',) + list_display = ('id', 'name', 'type', 'owner', 'date_created') """ BEGIN COMMON METHODS @@ -583,5 +583,5 @@ class Object(models.Model): def __str__(self): return "%s(#%d%s)" % (self.get_ansiname(), self.id, self.flag_string()) -import functions_db -import session_mgr +import evennia.functions_db +import evennia.session_mgr diff --git a/evennia/trunk/commands_general.py b/evennia/trunk/commands_general.py index 263e53b683..ad476122f7 100644 --- a/evennia/trunk/commands_general.py +++ b/evennia/trunk/commands_general.py @@ -3,7 +3,7 @@ import time import functions_general import functions_db import functions_help -import global_defines +import evennia.defines_global as global_defines import session_mgr import ansi import os @@ -231,10 +231,16 @@ def cmd_help(cdat): session.msg("Your search query is too short. It must be at least three letters long.") return - topics = functions_help.find_topicmatch(topicstr, pobject) + topics = functions_help.find_topicmatch(pobject, topicstr) if len(topics) == 0: session.msg("No matching topics found, please refine your search.") + suggestions = functions_help.find_topicsuggestions(pobject, topicstr) + if len(suggestions) > 0: + session.msg("Matching similarly named topics:") + for result in suggestions: + session.msg(" %s" % (result,)) + session.msg("You may type 'help <#>' to see any of these topics.") elif len(topics) > 1: session.msg("More than one match found:") for result in topics: diff --git a/evennia/trunk/global_defines.py b/evennia/trunk/defines_global.py old mode 100644 new mode 100755 similarity index 100% rename from evennia/trunk/global_defines.py rename to evennia/trunk/defines_global.py diff --git a/evennia/trunk/evennia.sql b/evennia/trunk/evennia.sql index 737f32d6eebca71de91f27eefeb332ab01767aaa..2dee0e83585707e9faad56977a9839b8a8b60d78 100755 GIT binary patch delta 419 zcmZqp!PM}BX@WH4`HeDfnHdjl7G&AYtZm0w%@mT6s*sVIQ=pKVS5j1|proK+s;3a1 zpI@TjmXnySq)?t%tdN+JviSr1eQt4cT?0cPQZTfzGBB|+u++1#Ff%td+Wbsd&W4Mb zk&}U$nTd^&b7JFfjm9cwR^Mi3M@uvFL?g@Ol;p&ew6tVnV?!fj1LH&>ZJ3;xYLR9# zSuf~_pee#cOG9%@bIZ+aLH`)Jn3*RsFi&K@&Abih-ezV^6=q*XLgq1p6iwy}QkZ-z zT#JK=*^_~}p4oF_qb;+U2@@xSBO@cfCMU0vfdP_V42`V}jr5F-P0S3&jd$i%eyS34IARyiJ^TtAlvA1iY*Bl8O8Tg+w5 dADNRkHU=^a3$n5@$P078!#Fara&p=3E&zDsa3lZ# delta 193 zcmZqp!PM}BX@WH4;f*qHnHeu`7UVd^EThjD%M_B4s!&>-TBM+qk(jQeP@Y(lv8qffA+6o9m-nH8!(M_`|%Z sgM|gi_{F^WUq71$4-0b{Bl8O8Tg+w5AAu?pnOT{iGni{nF5BG&0DjCnF8}}l diff --git a/evennia/trunk/functions_db.py b/evennia/trunk/functions_db.py index 6d86d0fb6a..0d49d5b665 100644 --- a/evennia/trunk/functions_db.py +++ b/evennia/trunk/functions_db.py @@ -3,7 +3,7 @@ from django.db import connection from django.contrib.auth.models import User from apps.objects.models import Object from apps.config.models import ConfigValue -import global_defines +import evennia.defines_global as global_defines import gameconf """ diff --git a/evennia/trunk/functions_help.py b/evennia/trunk/functions_help.py index eef3ffccfa..c3db745248 100644 --- a/evennia/trunk/functions_help.py +++ b/evennia/trunk/functions_help.py @@ -2,17 +2,28 @@ from apps.helpsys.models import HelpEntry """ Help system functions. """ -def find_topicmatch(topicstr, pobject): +def find_topicmatch(pobject, topicstr): """ Searches for matching topics based on player's input. """ + is_staff = pobject.is_staff() if topicstr.isdigit(): - return HelpEntry.objects.filter(id=topicstr) + if is_staff: + return HelpEntry.objects.filter(id=topicstr) + else: + return HelpEntry.objects.filter(id=topicstr).exclude(staff_only=1) else: - return HelpEntry.objects.filter(topicname__istartswith=topicstr) + if is_staff: + return HelpEntry.objects.filter(topicname__istartswith=topicstr) + else: + return HelpEntry.objects.filter(topicname__istartswith=topicstr).exclude(staff_only=1) -def find_topicsuggestions(topicstr, pobject): +def find_topicsuggestions(pobject, topicstr): """ Do a fuzzier "contains" match. """ - return HelpEntry.objects.filter(topicname__icontains=topicstr) + is_staff = pobject.is_staff() + if is_staff: + return HelpEntry.objects.filter(topicname__icontains=topicstr) + else: + return HelpEntry.objects.filter(topicname__icontains=topicstr).exclude(staff_only=1) diff --git a/evennia/trunk/prepenv.sh b/evennia/trunk/prepenv.sh index 89994384b2..7188e58fa7 100755 --- a/evennia/trunk/prepenv.sh +++ b/evennia/trunk/prepenv.sh @@ -1,4 +1,4 @@ #!/bin/bash export DJANGO_SETTINGS_MODULE="settings" -export PYTHONPATH=/home/evennia -python server.py +export PYTHONPATH=/home/gtaylor/dev/ +python2.5 server.py diff --git a/evennia/trunk/server.py b/evennia/trunk/server.py index 9e64226210..bffb33e701 100755 --- a/evennia/trunk/server.py +++ b/evennia/trunk/server.py @@ -1,6 +1,6 @@ from asyncore import dispatcher from asynchat import async_chat -import socket, asyncore, time, sys +import socket, asyncore, time from django.db import models from django.db import connection @@ -8,7 +8,7 @@ from apps.config.models import CommandAlias import scheduler import functions_db import functions_general -import global_defines +import evennia.defines_global as global_defines import session_mgr import gameconf import settings