Giter Site home page Giter Site logo

kotti_contentgenerator's Introduction

kotti_contentgenerator

This is an extension to Kotti that allows adding lots of fake content to your website. This could be useful in various testing situations (performance, having dummy content inserted in your testing website, etc).

Usage

You can get the @@contentgenerator view by including kotti_contentgenerator.views to your pyramid.includes setting:

pyramid.includes = kotti_contentgenerator.views

Screenshot

kotti_contentgenerator screenshot

Beyond the builtin types

You can integrate your own content type with kotti_contentgenerator by writing your own factory and attaching it to kotti_contentgenerator.generator.default_factories.

If you call the fake content generator from your own call, you can pass the new factories in the Generator constructor.:

from kotti_contentgenerator.generator import Generator
from kotti.resources import Document, File, get_root
from kotti_forum.resources import Forum     # example

generator = Generator(seed=123, depth=2, top_level=10000, sub_level=0,
                      users=2, root_types=(Document,)
                      content_types=(Document, File, Forum)
                      factories={Forum: my_forum_factory}
                      )
generator.generate(get_root())

The parameters to the Generator constructor are:

  • seed: a number that will seed the faker
  • depth: how many levels deep to go
  • top_level: how many items in the top level
  • sub_level: how many content items to create per level
  • users: how many users to create
  • root_types: content type names of objects to put in root
  • content_types: a list of content type names to build content from
  • factories: a mapping of factories for content, mapped by their content type name. This can be used to add new factories

Using a specific seed number is useful because it makes content generation repeatable. When generating content, kotti_contentgenerator wraps and iterates through the list of root_types and content_types, making the order of the generation the same all the time. By using fake-factory and seeding it with the seed number, the generated strings are the same for all repeated calls.

build status

Development happens at Github repository

Development

Contributions to kotti_contentgenerator are highly welcome. Just clone its Github repository and submit your contributions as pull requests.

kotti_contentgenerator's People

Contributors

tiberiuichim avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.