Skip to content
Brian edited this page Jan 4, 2016 · 1 revision

Errors

Class UrlNotAvailable

Caused In Case Of:

This error can be caused by two reasons:

  1. No access to the internet
  2. Invalid URL
Message:
Could not reach the given URL!

Class TemplateNotAvailable

Caused In Case Of:

This error is caused in case the provided template is not in the TEMPLATE_DATABASE.

Message:
The given template is not available!

Class ArgumentIsNotAString

Caused In Case Of:

The provided argument is no a string.

Message:
The given argument is not a string!

Functions

Function grab_online(template)

Description:

Makes a new folder with the name provided in template and fetches all the files for the given template from the internet.

Arguments:
Name Type Description
template string The name of requsted template
Returns:
Value Type Description
None None None will be returned
Raises:
Name Reason
[ArgumentIsNotAString](# Class ArgumentIsNotAString) If the given info is not a string
[TemplateNotAvailble](# Class TemplateNotAvailable) If the given template is not in the TEMPLATE_DATABASE

Function exists(dir_path)

Description:

Checks to see if the template directory in the given path exists.

Arguments:
Name Type Description
dir_path string A path of a directory
Returns:
Value Type Description
True boolean If the given directory exists
False boolean If the given directory doesn't exist
Raises:
Name Reason
[ArgumentIsNotAString](# Class ArgumentIsNotAString) If the given info is not a string
[TemplateNotAvailble](# Class TemplateNotAvailable) If the given template is not in the TEMPLATE_DATABASE

Function get_path(template)

Description:

Returns the directory of the the given template.

Arguments:
Name Type Description
template string The name of the choosen template
Returns:
Value Type Description
string The full path of the choosen tempalte
Raises:
Name Reason
[ArgumentIsNotAString](# Class ArgumentIsNotAString) If the given info is not a string
[TemplateNotAvailble](# Class TemplateNotAvailable) If the given template is not in the TEMPLATE_DATABASE

Function url_check(url)

Description:

Checks the existence of the URL.

Arguments:
Name Type Description
url string The URL to be checked
Returns:
Value Type Description
True boolean If URL exists
Raises:
Name Reason
[ArgumentIsNotAString](# Class ArgumentIsNotAString) If the given info is not a string
[UrlNotAvailable](# Class UrlNotAvailable) If URL is not available

Function check_template(template)

Description:

Checks if the given template has all the files locally.

Arguments:
Name Type Description
template string The template name to be checked
Returns:
Value Type Description
True boolean If all the files are locally present
False boolean If not all the files are locally present
Raises:
Name Reason
[ArgumentIsNotAString](# Class ArgumentIsNotAString) If the given info is not a string
[TemplateNotAvailble](# Class TemplateNotAvailable) If the given template is not in the TEMPLATE_DATABASE

Function clean_template(template)

Description:

Cleans the directory and all the files for the given template

Arguments:
Name Type Description
template string The template name to be cleaned
Returns:
Value Type Description
True boolean If the operation was successful
False boolean If the operation was not successful
Raises:
Name Reason
[ArgumentIsNotAString](# Class ArgumentIsNotAString) If the given info is not a string
[TemplateNotAvailble](# Class TemplateNotAvailable) If the given template is not in the TEMPLATE_DATABASE

Function is_type_string(info)

Description:

Checks to see if the given information is a string. The purpose of this function is to type check the input and it is used in the module extensivly.

Arguments:
Name Type Description
info Any Type The given information to be checked
Returns:
Value Type Description
True boolean If info is a string
Raises:
Name Reason
[ArgumentIsNotAString](# Class ArgumentIsNotAString) If the given info is not a string