def local_spy(project_name, module_name, filepath): print("local_spyspy", project_name, module_name, filepath) try: code_file = DS.get_file_contents(project_name, module_name, filepath) code_str = dcd(str.encode(code_file.content)).decode("utf-8") except UnknownObjectException as _: # code_str = "# File not found" raise HTTPError(404) return code_str
def modulerr(name): modl, namel = name, "__author__.py" try: code_file = DS.get_file_contents(modl, '', namel) code = "{" + dcd(str.encode( code_file.content)).decode("utf-8")[1:-2] + "}" code = json.loads(code) cenas = [(girl, code[girl.lower()]['author_nick'] if girl.lower() in code else 'livre') for girl in GIRLS] except Exception as err: cenas = [(girl, 'livre') for girl in GIRLS] return dict(pagetitle="SuPyGirls - {}".format(name), title=name, action="/supygirls/gamer/{}/".format(name), claim="{}/".format(name), image="garden.jpg", cenas=cenas)
def gamer(mod, name): modl, namel = mod.lower(), name.lower() try: code_file = DS.get_file_contents(modl, namel) code = code_file.content # code = dcd(str.encode(code_file.content)).decode("utf-8") except Exception as err: code = "# " + ".".join([modl, namel, "main.py"]) code = ecd(bytearray(code.encode("UTF8"))).decode("utf-8") print("Play gamer Exception", code, err) return dict( pagetitle='PLAY - SuPyGirls - {} - {}'.format(mod.capitalize(), name.capitalize()), title=name, modText=mod.capitalize(), nameText=name.capitalize(), image="supygirls_logo.png", mod=mod.replace(',', '_').lower(), code=code, brython_css=CSS, brython_js=JS, menu=[m.split(",") for m in MENU.split(":")])
def project(): modl, namel = "_spy", "__author__.py" try: code_file = DS.get_file_contents(modl, '', namel) code = "{" + dcd(str.encode( code_file.content)).decode("utf-8")[1:-2] + "}" # print('/supygirls/project ', code) code = json.loads(code) cenas = [(girl, code[girl.lower()]['author_nick'] if girl.lower() in code else 'livre') for girl in CGIRLS] except Exception as err: cenas = [(girl, 'livre') for girl in CGIRLS] # print('/supygirls/project ', err) return dict(pagetitle="SuPyGirls", action="/supygirls/moduler/", claim="", title="SUPYGIRLS", image="miro.jpg", cenas=cenas)
def _gamer_claim(projecter, moduler=""): modl, namel = projecter if moduler else '_spy', "__author__.py" form_values = "author_nick author_name author_email author_org author_site author_public".split( ) code = {key: request.params[key] for key in form_values} key = moduler if moduler else projecter spy = str({key: code}).replace("'", '"')[1:-1] + ",\n" # coded = str(code).replace("'", '"') author_index = projecter if moduler else '_spy' action = "/supygirls/gamer/{}/".format(projecter) claim = "{}/".format(projecter) if moduler else "" filename = "{}/__author__.py".format( moduler) if moduler else "__author__.py" try: print(author_index, projecter, filename, spy) code_status = DS.append_file(author_index, filename, spy) filename = '{}/__author__.py'.format( moduler) if moduler else '__author__.py' code_status += DS.create_file(projecter, filename, "{\n" + spy) print(code, filename) code_file = DS.get_file_contents(modl, '', namel) code = "{" + dcd(str.encode( code_file.content)).decode("utf-8")[1:-2] + "}" code = json.loads(code) cenas = [(girl, code[girl.lower()]['author_nick'] if girl.lower() in code else 'livre') for girl in GIRLS] except Exception as err: code_status = "Fail creating {}: {}".format(filename, err) cenas = [(girl, 'livre') for girl in GIRLS] return dict(pagetitle="SuPyGirls - {}".format(projecter), title=projecter, action=action, claim=claim, image="garden.jpg", cenas=cenas, status=code_status)