Exemple #1
0
def list(request):
    data = search_script_tag('scale_stat')
    scale = []
    for stat in data:
        scale.append(stat.db.longname)
    scale.sort()
    return render(request, 'scales/list.html', {'scale':scale })
Exemple #2
0
def list(request):
    data = search_script_tag('werewolf_rite_stat')
    rites = []
    for stat in data:
        rites.append(stat.db.longname)
    rites.sort()
    return render(request, 'rites/list.html', {'rites': rites})
Exemple #3
0
def list(request):
    data = search_script_tag('tribe_stat')
    tribes = []
    for stat in data:
        tribes.append(stat.db.longname)
    tribes.sort()
    return render(request, 'tribes/list.html', {'tribes': tribes})
Exemple #4
0
def editor(request, object_id):

    object_id = unquote(object_id)

    try:
        data = search_script_tag('kith_stat')
    except IndexError:
        raise Http404("I couldn't find a character with that ID.")

    stats = []
    for stat in data:
        if stat.db.longname[0:len(object_id)].lower() == object_id.lower():
            stats.append(stat)
    if len(stats) == 0:
        return render(request, 'kiths/error.html',
                      {'message': 'No matching kith'})
    if len(stats) > 1:
        return render(request, 'kiths/error.html',
                      {'message': 'Too many matching kiths'})
    stat = stats[0]
    starting_data = {
        'longname': stat.db.longname,
        'reference': stat.db.reference,
        'info': stat.db.info,
        'restricted': stat.db.restricted,
        'link': object_id
    }
    form = editForm(initial=starting_data)
    return render(request, 'kiths/editor.html', {
        'form': form,
        'kith_id': object_id
    })
Exemple #5
0
def sheet(request, object_id):

    object_id = unquote(object_id)

    try:
        data = search_script_tag('advantage_stat')
    except IndexError:
        raise Http404("I couldn't find a character with that ID.")

    stats = []
    for stat in data:
        if stat.db.longname[0:len(object_id)].lower() == object_id.lower():
            stats.append(stat)
    if len(stats) == 0:
        return render(request, 'advantages/error.html',
                      {'message': 'No matching advantages: ' + object_id})
    if len(stats) > 1:
        return render(request, 'advantages/error.html',
                      {'message': 'Too many matching advantages'})
    advantage = advantage_class()
    longname = stats[0].db.longname
    category = stats[0].db.category
    reference = stats[0].db.reference
    if stats[0].db.info != '':
        info = stats[0].db.info.replace('|/', '\n')
    else:
        info = chr(160)
    pool = stats[0].db.pool
    energy = stats[0].db.energy
    advantage.update(longname, category, reference, info, pool, energy)
    return render(request, 'advantages/sheet.html', {
        'advantage': advantage,
        'request': request,
        'id': quote(object_id)
    })
Exemple #6
0
def editor(request, object_id):

    object_id = unquote(object_id)

    try:
        data = search_script_tag('advantage_stat')
    except IndexError:
        raise Http404("I couldn't find a character with that ID.")

    stats = []
    for stat in data:
        if stat.db.longname[0:len(object_id)].lower() == object_id.lower():
            stats.append(stat)
    if len(stats) == 0:
        return render(request, 'advantages/error.html',
                      {'message': 'No matching advantage'})
    if len(stats) > 1:
        return render(request, 'advantages/error.html',
                      {'message': 'Too many matching advantages'})
    advantage = stats[0]
    starting_data = {
        'longname': advantage.db.longname,
        'category': advantage.db.category,
        'reference': advantage.db.reference,
        'info': advantage.db.info,
        'pool': advantage.db.pool,
        'energy': advantage.db.energy,
        'link': object_id
    }
    form = EditForm(initial=starting_data)
    return render(request, 'advantages/editor.html', {
        'form': form,
        'advantage_id': object_id
    })
Exemple #7
0
def list(request):
    data = search_script_tag('path_stat')
    paths = []
    for stat in data:
        paths.append(stat.db.longname)
    paths.sort()
    return render(request, 'paths/list.html', {'paths': paths})
Exemple #8
0
def sheet(request, object_id):

    object_id = unquote(object_id)

    try:
        data = search_script_tag('power_stat')
    except IndexError:
        raise Http404("I couldn't find a character with that ID.")

    stats = []
    for stat in data:
        if stat.db.longname[0:len(object_id)].lower() == object_id.lower():
            stats.append(stat)
    if len(stats) == 0:
        return render(request, 'powers/error.html',
                      {'message': 'No matching powers: ' + object_id})
    if len(stats) > 1:
        return render(request, 'powers/error.html',
                      {'message': 'Too many matching powers'})
    power = power_class()
    longname = stats[0].db.longname
    category = stats[0].db.category
    reference = stats[0].db.reference
    if stats[0].db.info:
        info = stats[0].db.info.replace('|/', '\n')
    else:
        info = chr(160)
    restricted = stats[0].db.restricted
    power.update(longname, category, reference, info, restricted)
    return render(request, 'powers/sheet.html', {
        'power': power,
        'request': request,
        'id': quote(object_id)
    })
Exemple #9
0
 def generate_data(self):
     dictionary = {}
     lists = {}
     stats = search_script_tag('stat_data')
     for stat in stats:
         if stat.type() not in ['basic', 'power', 'sphere']:
             if stat.type() in lists:
                 lists[stat.type()].append(stat.db.longname)
             else:
                 lists[stat.type()] = [stat.db.longname]
         word = ''
         for letter in stat.db.longname:
             word = word + letter.lower()
             if word in dictionary:
                 dictionary[word].append(
                     [stat.db.longname,
                      stat.type(), stat.id])
             else:
                 dictionary[word] = [[
                     stat.db.longname,
                     stat.type(), stat.id
                 ]]
     for stat in stats:
         list = dictionary[stat.db.longname.lower()]
         counter = 0
         keep_list = []
         for item in list:
             if stat.db.longname == item[0].strip():
                 keep_list.append(counter)
             counter = counter + 1
         new_list = []
         for item in keep_list:
             new_list.append(list[item])
         dictionary[stat.db.longname.lower()] = new_list
     return [dictionary, lists]
Exemple #10
0
def list(request):
    data = search_script_tag('theban_rite_stat')
    theban = []
    for stat in data:
        theban.append(stat.db.longname)
    theban.sort()
    return render(request, 'theban/list.html', {'theban':theban })
Exemple #11
0
def sheet(request, object_id):

    object_id = unquote(object_id)

    try:
        data = search_script_tag('theban_rite_stat')
    except IndexError:
        raise Http404("I couldn't find a character with that ID.")

    stats = []
    for stat in data:
        if stat.db.longname[0:len(object_id)].lower() == object_id.lower():
            stats.append(stat)
    if len(stats) == 0:
        return render(request, 'theban/error.html', {'message': 'No matching theban: '+object_id})
    if len(stats) > 1:
        return render(request, 'theban/error.html', {'message': 'Too many matching theban'})
    theban = theban_class()
    longname = stats[0].db.longname
    rank = stats[0].db.rank
    prereq = stats[0].db.prereq
    reference = stats[0].db.reference
    if stats[0].db.info:
        info = stats[0].db.info.replace('|/','\n')
    else:
        info = chr(160)
    restricted = stats[0].db.restricted
    theban.update(longname,rank,prereq,reference,info,restricted)
    if request.method == 'POST':
         return render(request, 'theban/error.html', {'message': 'POST'})
    return render(request, 'theban/sheet.html', {'theban': theban, 'request':request, 'id':quote(object_id)})
Exemple #12
0
def list(request):
    data = search_script_tag('devotion_stat')
    devotions = []
    for stat in data:
        devotions.append(stat.db.longname)
    devotions.sort()
    return render(request, 'devotions/list.html', {'devotions': devotions})
Exemple #13
0
def editted(request):
    user = request.user
    if user.is_staff:
        if request.method == 'POST':
            form = editForm(request.POST)
            if form.is_valid():
                try:
                    data = search_script_tag('kith_stat')
                except IndexError:
                    raise Http404("I couldn't find a character with that ID.")
                stats = []
                n = form.cleaned_data['link']
                for stat in data:
                    if stat.db.longname[0:len(n)].lower() == n.lower():
                        stats.append(stat)
                if len(stats) == 0:
                    return render(
                        request, 'kiths/error.html',
                        {'message': len(data) + ' No matching kiths: ' + n})
                if len(stats) > 1:
                    return render(request, 'kiths/error.html',
                                  {'message': 'Too many matching kiths'})
                kith = stats[0]
                app = kith.update(longname=form.cleaned_data['longname'],
                                  reference=form.cleaned_data['reference'],
                                  info=form.cleaned_data['info'],
                                  restricted=form.cleaned_data['restricted'])
                return HttpResponseRedirect('/kiths/view/' + quote(n))
            else:
                return render(request, 'kiths/error.html',
                              {'message': 'Invalid form'})
        else:
            return render(request, 'kiths/error.html', {'message': 'Not POST'})
    else:
        return render(request, 'kiths/error.html', {'message': 'Not staff'})
Exemple #14
0
def sheet(request, object_id):

    object_id = unquote(object_id)

    try:
        data = search_script_tag('tribe_stat')
    except IndexError:
        raise Http404("I couldn't find a character with that ID.")

    stats = []
    for stat in data:
        if stat.db.longname[0:len(object_id)].lower() == object_id.lower():
            stats.append(stat)
    if len(stats) == 0:
        return render(request, 'tribes/error.html',
                      {'message': 'No matching tribe: ' + object_id})
    if len(stats) > 1:
        return render(request, 'tribes/error.html',
                      {'message': 'Too many matching tribes'})
    tribe = tribe_class()
    longname = stats[0].db.longname
    renown = stats[0].db.renown
    tribe_gifts = stats[0].db.tribe_gifts
    if stats[0].db.info:
        info = stats[0].db.info.replace('|/', '\n')
    else:
        info = chr(160)
    reference = stats[0].db.reference
    restricted = stats[0].db.restricted
    tribe.update(longname, renown, tribe_gifts, info, reference, restricted)
    return render(request, 'tribes/sheet.html', {
        'tribe': tribe,
        'request': request,
        'id': quote(object_id)
    })
Exemple #15
0
def list(request):
    data = search_script_tag('arcana_stat')
    arcana = []
    for stat in data:
        arcana.append(stat.db.longname)
    arcana.sort()
    return render(request, 'arcana/list.html', {'arcana': arcana})
    def func(self):
        caller = self.caller

        recipes = search.search_script_tag(_PUZZLES_TAG_RECIPE,
                                           category=_PUZZLES_TAG_CATEGORY)

        div = "-" * 60
        text = [div]
        msgf_recipe = "Puzzle |y'%s' %s(%s)|n"
        msgf_item = "%2s|c%15s|n: |w%s|n"
        for recipe in recipes:
            text.append(msgf_recipe %
                        (recipe.db.puzzle_name, recipe.name, recipe.dbref))
            text.append("Success Caller message:\n" +
                        recipe.db.use_success_message + "\n")
            text.append("Success Location message:\n" +
                        recipe.db.use_success_location_message + "\n")
            text.append("Mask:\n" + str(recipe.db.mask) + "\n")
            text.append("Parts")
            for protopart in recipe.db.parts[:]:
                mark = "-"
                for k, v in protopart.items():
                    text.append(msgf_item % (mark, k, v))
                    mark = ""
            text.append("Results")
            for protoresult in recipe.db.results[:]:
                mark = "-"
                for k, v in protoresult.items():
                    text.append(msgf_item % (mark, k, v))
                    mark = ""
        else:
            text.append(div)
            text.append("Found |r%d|n puzzle(s)." % (len(recipes)))
            text.append(div)
        caller.msg("\n".join(text))
Exemple #17
0
def list(request):
    data = search_script_tag('cruac_rite_stat')
    cruac = []
    for stat in data:
        cruac.append(stat.db.longname)
    cruac.sort()
    return render(request, 'cruac/list.html', {'cruac': cruac})
Exemple #18
0
def list(request):
    data = search_script_tag('auspice_stat')
    auspices = []
    for stat in data:
        auspices.append(stat.db.longname)
    auspices.sort()
    return render(request, 'auspices/list.html', {'auspices': auspices})
Exemple #19
0
def list(request):
    data = search_script_tag('coil_stat')
    coils = []
    for stat in data:
        coils.append(stat.db.longname)
    coils.sort()
    return render(request, 'coils/list.html', {'coils':coils })
Exemple #20
0
def vampire_template(caller, raw_string, **kwargs):
    caller.db.cg['start_menu'] = 'cg_vampire'
    caller.db.cg['start_node'] = 'vampire_template'
    caller.db.cg['raw_string'] = strip_control_sequences(raw_string)
    caller.db.cg['kwargs'] = kwargs
    caller.db.basics = {'Sphere': 'Vampire'}
    caller.db.sphere = {'Banes': []}
    caller.db.power = {'Blood Potency': 1}
    text = 'Select Clan:'
    option_list = []
    clans_list = search_script_tag('clan_stat')
    clans = []
    for item in clans_list:
        if item.db.restricted == False:
            clans.append([item.db.longname, item])
    clans = sorted(clans, key=itemgetter(0))
    for item in clans:
        option_list.append({
            'desc': item[0],
            'goto': (_vampire_set_clan, {
                'clan': item[1]
            })
        })
    option_list.append({
        'desc': 'Back',
        'key': 'B',
        'goto': 'return_to_main_cg'
    })
    option_list.append({
        'desc': 'Back',
        'key': 'back',
        'goto': 'return_to_main_cg'
    })
    option_list.append({'key': 'q', 'desc': 'Quit', 'goto': 'quit_menu'})
    option_list.append({'key': 'Quit', 'desc': 'Quit', 'goto': 'quit_menu'})
    options = tuple(option_list)
    footer = '|/(Additional options include |w\'help\'|n and |w\'quit\'|n)'
    help = ('|/' + '_' * 79 + '|/|/' +
            'Clan is more archetype than personality. While the Disciplines ' +
            'and banes of the various clans may influence behavior, any ' +
            'person could be Embraced into any clan. There\'s something to ' +
            'be said for playing into stereotypes, but challenging ' +
            'established norms can be very fulfilling.|/|/Your choice of ' +
            'clan determines the Disciplines with which your character has ' +
            'an affinity. As well, every clan has two favored Attributes. ' +
            'Take an additional dot in one of these. This can only take an ' +
            'Attribute to five dots.' + '|/' + '_' * 79)
    options_format = {
        'hide_keys': ['q', 'Quit', 'back'],
        'move_keys': ['B', 'P'],
        'rows': 10
    }
    display = {
        'text': text,
        'help': help,
        'options_format': options_format,
        'footer': footer
    }
    return display, options
Exemple #21
0
def list(request):
    data = search_script_tag('covenant_stat')
    groups = []
    covenants = []
    for stat in data:
        covenants.append(stat.db.longname)
    covenants.sort()
    return render(request, 'covenants/list.html', {'covenants': covenants})
Exemple #22
0
def list(request):
    data = search_script_tag('kith_stat')
    groups = []
    kiths = []
    for stat in data:
        kiths.append(stat.db.longname)
    kiths.sort()
    return render(request, 'kiths/list.html', {'kiths': kiths})
Exemple #23
0
def list(request):
    data = search_script_tag('seeming_stat')
    groups = []
    seemings = []
    for stat in data:
        seemings.append(stat.db.longname)
    seemings.sort()
    return render(request, 'seemings/list.html', {'seemings': seemings})
Exemple #24
0
def list(request):
    data = search_script_tag('clan_stat')
    groups = []
    clans = []
    for stat in data:
        clans.append(stat.db.longname)
    clans.sort()
    return render(request, 'clans/list.html', {'clans': clans})
Exemple #25
0
def list(request):
    data = search_script_tag('discipline_stat')
    disciplines = []
    for stat in data:
        disciplines.append(stat.db.longname)
    disciplines.sort()
    return render(request, 'disciplines/list.html',
                  {'disciplines': disciplines})
Exemple #26
0
def werewolf_template(caller, raw_string, **kwargs):
    caller.db.cg['start_menu'] = 'cg_werewolf'
    caller.db.cg['start_node'] = 'werewolf_template'
    caller.db.cg['raw_string'] = strip_control_sequences(raw_string)
    caller.db.cg['kwargs'] = kwargs
    caller.db.basics = { 'Sphere' : 'Werewolf' }
    caller.db.renown = {'Cunning': 0, 'Glory': 0, 'Honor': 0, 'Purity': 0,
                        'Wisdom': 0}
    caller.db.power = { 'Primal Urge' : 1 }
    caller.db.gifts = {}
    caller.db.werewolfRites = {}
    text = 'Select Auspice:'
    option_list = []
    auspices_list = search_script_tag('auspice_stat')
    auspices=[]
    for item in auspices_list:
        if item.db.restricted == False:
            auspices.append([item.db.longname,item])
    auspices = sorted(auspices,key=itemgetter(0))
    for item in auspices:
        option_list.append( {'desc' : item[0],
                             'goto' : ( _werewolf_set_auspice,
                                        { 'auspice' : item[1] } ) } )
    option_list.append({'desc': 'Back',
                        'key': 'B',
                        'goto': 'return_to_main_cg'})
    option_list.append({'desc': 'Back',
                        'key': 'back',
                        'goto': 'return_to_main_cg'})
    option_list.append({'key': 'q',
                        'desc': 'Quit',
                        'goto': 'quit_menu'})
    option_list.append({'key': 'Quit',
                        'desc': 'Quit',
                        'goto': 'quit_menu'})
    options = tuple(option_list)
    footer = '|/(Additional options include |w\'help\'|n and |w\'quit\'|n)'
    help = ('|/' + '_' * 79 + '|/|/' +
            'Auspice, the moon under which a werewolf changes, is her first ' +
            'defining trait as one of the Forsaken. Auspice helps guide her ' +
            'in her expected role among the Uratha. A character\'s auspice ' +
            'offers certain advantages in fulfilling that role, and Uratha ' +
            'often look down upon those who deviate too far from their ' +
            'expected roles.|/|/From a character creation standpoint, ' +
            'auspice offers you a free dot of one of three Skills, and one ' +
            'of your starting Renown dots. You can choose any of the three ' +
            'auspice Skills, but this free dot cannot take the Skill beyond ' +
            'five dots.' + '|/' + '_' * 79)
    options_format = {'hide_keys': ['q', 'Quit', 'back'],
                      'move_keys': ['B', 'P'],
                      'rows': 10}
    display = {'text': text,
               'help': help,
               'options_format': options_format,
               'footer': footer}
    return display, options
Exemple #27
0
def werewolf_renown(caller, raw_string, **kwargs):
    caller.db.cg['start_node'] = 'werewolf_renown'
    caller.db.cg['raw_string'] = strip_control_sequences(raw_string)
    caller.db.cg['kwargs'] = kwargs
    text = ('Select one renown to boost:' +
            '|/|_|_|_|_Cunning: ' +
            str(caller.get('Cunning', statclass='Renown')) +
            '|/|_|_|_|_Glory: ' +
            str(caller.get('Glory', statclass='Renown')) +
            '|/|_|_|_|_Honor: ' +
            str(caller.get('Honor', statclass='Renown')) +
            '|/|_|_|_|_Purity: ' +
            str(caller.get('Purity', statclass='Renown')) +
            '|/|_|_|_|_Wisdom: ' +
            str(caller.get('Wisdom', statclass='Renown')))
    renown_list = search_script_tag('renown_stat')
    renown = []
    for item in renown_list:
        renown.append([item.db.longname, item])
    renown = sorted(renown, key=itemgetter(0))
    option_list = []
    for item in renown:
        option_list.append({'desc': item[0],
                            'goto': (_raise_renown,
                                     {'renown': item[1]})})
    option_list.append({'desc': 'Back',
                        'key': 'B',
                        'goto': _return_to_tribe})
    option_list.append({'desc': 'Back',
                        'key': 'back',
                        'goto': _return_to_tribe})
    option_list.append({'key': 'q',
                        'desc': 'Quit',
                        'goto': 'quit_menu'})
    option_list.append({'key': 'Quit',
                        'desc': 'Quit',
                        'goto': 'quit_menu'})
    options = tuple(option_list)
    footer = '|/(Additional options include |w\'help\'|n and |w\'quit\'|n)'
    help = ('|/' + '_' * 79 + '|/|/' +
            'Choose another dot in a Renown of your choice, but note that ' +
            'you cannot take a third dot in a single Renown at this point. ' +
            'Ghost Wolves receive this dot of Renown, for a total of two.' +
            '|/' + '_' * 79)
    options_format = {'hide_keys': ['q', 'Quit', 'back'],
                      'move_keys': ['B', 'P'],
                      'rows': 10}
    display = {'text': text,
               'help': help,
               'options_format': options_format,
               'footer': footer}
    return display, options
Exemple #28
0
def editted(request):
    user = request.user
    if user.is_staff:
        if request.method == 'POST':
            form = editForm(request.POST)
            if form.is_valid():
                try:
                    data = search_script_tag('auspice_stat')
                except IndexError:
                    raise Http404("I couldn't find a character with that ID.")
                stats = []
                n = form.cleaned_data['link']
                for stat in data:
                    if stat.db.longname[0:len(n)].lower() == n.lower():
                        stats.append(stat)
                if len(stats) == 0:
                    return render(
                        request, 'auspices/error.html',
                        {'message': len(data) + ' No matching auspices: ' + n})
                if len(stats) > 1:
                    return render(request, 'auspices/error.html',
                                  {'message': 'Too many matching auspices'})
                auspice = stats[0]
                auspice_skills = []
                if form.cleaned_data['auspice_skills'] != '[]':
                    for item in form.cleaned_data['auspice_skills'][
                            1:-1].split(','):
                        auspice_skills.append(item.strip()[1:-1])
                auspice_gifts = []
                if form.cleaned_data['auspice_gifts'] != '[]':
                    for item in form.cleaned_data['auspice_gifts'][1:-1].split(
                            ','):
                        auspice_gifts.append(item.strip()[1:-1])
                auspice = auspice.update(
                    longname=form.cleaned_data['longname'],
                    auspice_skills=auspice_skills,
                    renown=form.cleaned_data['renown'],
                    auspice_gifts=form.cleaned_data['auspice_gifts'],
                    info=form.cleaned_data['info'],
                    reference=form.cleaned_data['reference'],
                    restricted=form.cleaned_data['restricted'])
                return HttpResponseRedirect('/auspices/view/' + quote(n))
            else:
                return render(request, 'auspices/error.html',
                              {'message': 'Invalid form'})
        else:
            return render(request, 'auspices/error.html',
                          {'message': 'Not POST'})
    else:
        return render(request, 'auspices/error.html', {'message': 'Not staff'})
Exemple #29
0
def vampire_covenant(caller, raw_string, **kwargs):
    caller.db.cg['start_node'] = 'vampire_covenant'
    caller.db.cg['raw_string'] = strip_control_sequences(raw_string)
    caller.db.cg['kwargs'] = kwargs
    text = 'Select Covenant:'
    covenants_list = search_script_tag('covenant_stat')
    covenants = []
    for item in covenants_list:
        if item.db.restricted == False:
            covenants.append([item.db.longname, item])
    covenants = sorted(covenants, key=itemgetter(0))
    option_list = []
    for item in covenants:
        option_list.append({
            'desc': item[0],
            'goto': (_set_covenant, {
                'covenant': item[1]
            })
        })
    option_list.append({'desc': 'Unaligned', 'goto': _no_covenant})
    option_list.append({'desc': 'Back', 'key': 'B', 'goto': _return_to_stat})
    option_list.append({
        'desc': 'Back',
        'key': 'back',
        'goto': _return_to_stat
    })
    option_list.append({'key': 'q', 'desc': 'Quit', 'goto': 'quit_menu'})
    option_list.append({'key': 'Quit', 'desc': 'Quit', 'goto': 'quit_menu'})
    options = tuple(option_list)
    footer = '|/(Additional options include |w\'help\'|n and |w\'quit\'|n)'
    help = ('|/' + '_' * 79 + '|/|/' +
            'Covenants are Kindred social orders. While your character\'s ' +
            'sire may influence her covenant choice, ultimately the choice ' +
            'is hers. Also, it may change with time. You may choose to start '
            + 'play without a covenant. Kindred without covenants are often ' +
            'seen as untrustworthy, but they have more freedom to negotiate ' +
            'their own alliances.' + '|/' + '_' * 79)
    options_format = {
        'hide_keys': ['q', 'Quit', 'back'],
        'move_keys': ['B', 'P'],
        'rows': 10
    }
    display = {
        'text': text,
        'help': help,
        'options_format': options_format,
        'footer': footer
    }
    return display, options
Exemple #30
0
def editted(request):
    user = request.user
    if user.is_staff:
        if request.method == 'POST':
            form = EditForm(request.POST)
            if form.is_valid():
                try:
                    data = search_script_tag('clan_stat')
                except IndexError:
                    raise Http404("I couldn't find a character with that ID.")
                stats = []
                n = form.cleaned_data['link']
                for stat in data:
                    if stat.db.longname[0:len(n)].lower() == n.lower():
                        stats.append(stat)
                if len(stats) == 0:
                    return render(
                        request, 'clans/error.html',
                        {'message': len(data) + ' No matching clans: ' + n})
                if len(stats) > 1:
                    return render(request, 'clans/error.html',
                                  {'message': 'Too many matching clans'})
                clan = stats[0]
                favored_attributes = []
                if form.cleaned_data['favored_attributes'] != '[]':
                    for item in form.cleaned_data['favored_attributes'][
                            1:-1].split(','):
                        favored_attributes.append(item.strip()[1:-1])
                favored_disciplines = []
                if form.cleaned_data['favored_disciplines'] != '[]':
                    for item in form.cleaned_data['favored_disciplines'][
                            1:-1].split(','):
                        favored_disciplines.append(item.strip()[1:-1])
                app = clan.update(longname=form.cleaned_data['longname'],
                                  favored_attributes=favored_attributes,
                                  favored_disciplines=favored_disciplines,
                                  reference=form.cleaned_data['reference'],
                                  info=form.cleaned_data['info'],
                                  bloodline=form.cleaned_data['bloodline'],
                                  restricted=form.cleaned_data['restricted'])
                return HttpResponseRedirect('/clans/view/' + quote(n))
            else:
                return render(request, 'clans/error.html',
                              {'message': 'Invalid form'})
        else:
            return render(request, 'clans/error.html', {'message': 'Not POST'})
    else:
        return render(request, 'clans/error.html', {'message': 'Not staff'})