TagPython

Dependency Inversion w/Mongo Engine + Flask

Page defines our object’s attributes. This allows us to create an object instance with the following attributes: author, content, title, and meta_attributes. /app/domain/page/page_model.py from cms.services.schema.page_schema import PageSchema class Page(PageSchema): """ Page class """ def __init__(self, author, content, title, meta_attributes, *args, **values): """ Instantiate page object...

Python: A Primer on Dictionaries

Python dictionaries are indexed by keys. Strings and numbers can always be keys. Tuples can be too if they contain strings, numbers, or tuples. Dictionaries consist of key and value pairs. An empty pair of braces creates an empty dictionary empty_dictionary = {} You can list a dictionary’s keys my_dictionary = {'User 1': 'AwesomePassword', 'User 2': 'AnotherPassword'}‚Äčlist(my_dictionary)...