예제 #1
0
    def setUp(self):
        """
        initialize a manager.
        """

        self.manager = CalendarManager(storage=Middleware.get_middleware_by_uri('mongodb-default-calendar://'))
        self.document_content = self.manager.get_document(
            category="2", output="true date or not",
            dtstart=1434359519, dtend=1434705119
        )
        self.vevent_content = self.manager.get_vevent(
            self.document_content
        )
        print("type and value of vevent_content", self.vevent_content)
예제 #2
0
# Canopsis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Canopsis.  If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------

from json import dumps

from canopsis.ccalendar.manager import CalendarManager
from canopsis.common.ws import route
from canopsis.common.middleware import Middleware

cm = CalendarManager(storage=Middleware.get_middleware_by_uri(
    CalendarManager.CALENDAR_COLL_URI))


def exports(ws):
    @route(ws.application.get, name='calendar')
    def get_by_uids(uids,
                    limit=0,
                    skip=0,
                    sort=None,
                    projection=None,
                    with_count=False):
        """Get documents by uids.

        :param list uids: list of document uids.
        :param int limit: max number of elements to get.
        :param int skip: first element index among searched list.