Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(32)  |  Call(24)  |  Derive(0)  |  Import(8)

src/l/a/Lampost-Mud-HEAD/lampost/client/settings.py   Lampost-Mud(Download)
from lampost.client.user import User
from lampost.context.resource import m_requires, requires
from lampost.datastore.exceptions import DataError
from lampost.model.player import Player
from lampost.util.encrypt import make_hash, check_password
    def render_POST(self, content, session):
        account_name = content.account_name.lower()
        if get_index("ix:user:name", account_name) or object_exists('player', account_name):
            raise DataError("InUse: {}".format(content.account_name))
        user = user_manager.create_user(account_name, content.password, content.email.lower())
 
        if user_manager.check_name(update_dict['user_name'], old_user) != "ok":
            raise DataError("InUse: {}".format(update_dict['user_name']))
        user = User(user_id)
        if update_dict['password']:
    def render_POST(self, content):
        user = load_object(User, content.user_id)
        if not user:
            raise DataError("User {0} does not exist".format([content.user_id]))
        player_name = content.player_name.lower()
        if player_name != user.user_name and get_index("ix:user:user_name", player_name):
            raise DataError(content.player_name + " is in use.")

src/l/a/Lampost-Mud-HEAD/lampost/editor/scripts.py   Lampost-Mud(Download)
from lampost.context.resource import m_requires
from lampost.datastore.exceptions import DataError
from lampost.editor.children import EditChildrenResource
 
m_requires('perm', 'script_manager', __name__)
    def pre_update(self, script, new_script, session):
        self._check_perm(script, session)
        if new_script['from_file'] and not script.from_file:
            raise DataError("File scripts must be initiated on the file system.")
        try:
            compile(new_script['live_text'], '<string>', 'exec')
        except SyntaxError as syn_error:
            raise DataError("Syntax Error: {}  text:{}  line: {}  offset: {}".format(syn_error.msg, syn_error.text, syn_error.lineno, syn_error.offset))
        except BaseException as other_error:
            raise DataError("Script Error: {}".format(other_error.msg))
                script.write(new_script['live_text'])
            except EnvironmentError:
                raise DataError("Failed to write new text to file")
        else:
            new_script['text'] = new_script['live_text']

src/l/a/Lampost-Mud-HEAD/lampost/editor/players.py   Lampost-Mud(Download)
from lampost.context.resource import m_requires
from lampost.datastore.exceptions import DataError
from lampost.editor.base import EditResource
from lampost.client.user import User
 
    def pre_delete(self, player, session):
        if player.imm_level >= perm_level('supreme'):
            raise DataError("Cannot delete root user.")
        if hasattr(player, 'session'):
            raise DataError("Player is logged in.")

src/l/a/Lampost-Mud-HEAD/lampost/editor/areas.py   Lampost-Mud(Download)
from twisted.web.resource import Resource
from lampost.client.resources import request
from lampost.datastore.classes import get_dbo_class
from lampost.context.resource import m_requires
from lampost.datastore.exceptions import DataError
    def render_POST(self, content, session):
        area, room = find_area_room(content.start_room, session)
        new_dir = Direction.ref_map[content.direction]
        if room.find_exit(new_dir):
            raise DataError("Room already has " + new_dir.dbo_id + " exit.")
            other_area, other_room = find_area_room(other_id, session)
            if not content.one_way and other_room.find_exit(rev_dir):
                raise DataError("Room " + other_id + " already has a " + rev_dir.obj_id + " exit.")
        this_exit = get_dbo_class('exit')()
        this_exit.direction = new_dir
        local_exit = room.find_exit(direction)
        if not local_exit:
            raise DataError('Exit does not exist')
        room.exits.remove(local_exit)
        save_object(room)
    def render_POST(self, content, session):
        room = load_object(Room, content.room_id)
        if not room:
            raise DataError("ROOM_MISSING")
        room.reset()

src/l/a/Lampost-Mud-HEAD/lampost/editor/socials.py   Lampost-Mud(Download)
from twisted.web.resource import Resource
 
from lampost.client.resources import request
from lampost.context.resource import m_requires
from lampost.datastore.exceptions import DataError
    def pre_create(self, social_dto, session):
        if (social_dto['dbo_id'],) in mud_actions:
            raise DataError("Verb already in use")
 
    def post_delete(self, social, session):

src/l/a/Lampost-Mud-HEAD/lampost/editor/base.py   Lampost-Mud(Download)
from twisted.web.resource import Resource
from lampost.client.resources import request
from lampost.context.resource import m_requires
from lampost.datastore.exceptions import DataError
 
    def render_POST(self, raw, session):
        del_obj = load_object(self.obj_class, raw['dbo_id'])
        if not del_obj:
            raise DataError('Gone: Object with key {} does not exist'.format(raw['dbo_id']))
        check_perm(session, del_obj)
    def render_POST(self, raw, session):
        existing_obj = load_object(self.obj_class, raw['dbo_id'])
        if not existing_obj:
            raise DataError("GONE:  Object with key {} no longer exists.".format(raw['dbo.id']))
        check_perm(session, existing_obj)

src/l/a/Lampost-Mud-HEAD/lampost/editor/children.py   Lampost-Mud(Download)
from twisted.web.resource import Resource
from lampost.client.resources import request
from lampost.context.resource import m_requires
from lampost.datastore.exceptions import DataError
from lampost.editor.base import EditResource, EditBaseResource
    parent = load_by_key(parent_type, dbo_id.split(':')[0])
    if not parent:
        raise DataError("Parent Missing")
    return parent
 

src/l/a/Lampost-Mud-HEAD/lampost/client/resources.py   Lampost-Mud(Download)
from twisted.web.resource import Resource, NoResource
from twisted.web.server import NOT_DONE_YET
from lampost.datastore.exceptions import DataError
 
from lampost.util.lmlog import logged