Shopyoapi

Shopyo has some api which eases your life

api.database

api.database.autoload_models(verbose=False)[source]

Auto imports models from modules/ in desired file. Used so that flask_migrate does not miss models when migrating

Returns

Return type

None

api.enhance

api.enhance.base_context()[source]

Used to define global template values

Returns

copy of dictionary

Return type

dict

api.enhance.get_active_theme_dir()[source]
api.enhance.set_setting(key, value)[source]

api.file

api.file.absdiroffile(filepath)[source]

Gives absolute directory of file, normally expects __file__ as param

Parameters

filepath (str) – path of file

Returns

Absolute dir path of file

Return type

str

api.file.delete_file(path)[source]
api.file.get_folders(path)[source]
api.file.trycopy(source, dest, verbose=False)[source]

Non-ecursive copy of folder

Parameters
  • source (str) – source folder path

  • dest (str) – destination folder path

Returns

Return type

None

api.file.trycopytree(source, dest, verbose=False)[source]

Recursive copy of folder

Parameters
  • source (str) – source folder path

  • dest (str) – destination folder path

Returns

Return type

None

api.file.trymkdir(path, verbose=False)[source]

Creates dir at destination

Parameters

path (str) – path with folder already in

Returns

Return type

None

api.file.trymkfile(path, content, verbose=False)[source]

Creates file

Parameters
  • path (str) – path to create file with filename included

  • content (str) – file content

Returns

Return type

None

api.file.tryrmcache(dir_name, verbose=False)[source]

removes all __pycache__ starting from directory dir_name all the way to leaf directory

Parameters

dir_name (string) – path from where to start removing pycache

api.file.tryrmfile(path, verbose=False)[source]

tries to remove file path and output message to stdin or stderr. Path must point to a file

Parameters

path (string) – path of the file to remove

Returns

returns true upon successful removal false otherwise

Return type

bool

api.file.tryrmtree(path, verbose=False)[source]

Tries to removes an entire directory tree. Path must point to a directory. Outputs message to stdin or stderr

Parameters

path (string) – directory path to be removed

Returns

returns true upon successful return false otherwise

Return type

bool

api.file.unique_filename(fname)[source]

api.forms

api.forms.flash_errors(form)[source]

Auto flash errors from WKHtml forms Reqwires base module or similar notification mechanism

Parameters

form (WKHtml form) –

Returns

Return type

None

api.html

Used on flash flash(notify_success(‘mail sent!’))

api.html.notify(message, alert_type='primary')[source]
Used with flash

flash(notify(‘blabla’))

Parameters
  • message (str) – message to be displayed

  • alert_type (str) – bootstrap class

Returns

Return type

None

api.html.notify_danger(message)[source]
api.html.notify_info(message)[source]
api.html.notify_success(message)[source]
api.html.notify_warning(message)[source]

api.info

api.info.printinfo()[source]

prints Shopyo copyright in ASCII art font

api.module

class api.module.ModuleHelp(dunderfile, dundername)[source]

Bases: object

context()[source]
get_self_static(filename)[source]
method(methodname)[source]
redirect_url(url, **kwargs)[source]
render(filename, **kwargs)[source]

renders file.html found in module/templates/module/file.html

api.templates

api.templates.yo_render(template, context_dict)[source]