コード例 #1
0
        def __init__(self):
            Uri.__init__(self, is_collection, "lines")
            self.collections = [
                ("lines", NonNullList(fields.Nested(line,
                                                    display_null=False))),
                ("pagination", PbField(pagination)), ("error", PbField(error)),
                ("disruptions",
                 fields.List(NonNullNested(disruption_marshaller),
                             attribute="impacts")),
                ("feed_publishers",
                 NonNullList(fields.Nested(feed_publisher,
                                           display_null=False)))
            ]
            if current_app.config.get('USE_SERPY', False):
                collections = serialize_with(api.LinesSerializer)
            else:
                collections = marshal_with(OrderedDict(self.collections),
                                           display_null=False)
            self.method_decorators.insert(1, collections)

            self.parsers["get"].add_argument(
                "original_id",
                type=unicode,
                description="original uri of the object you"
                "want to query")
コード例 #2
0
 def __init__(self):
     Uri.__init__(self, is_collection, "physical_modes")
     self.collections = [
         ("physical_modes",
          NonNullList(fields.Nested(physical_mode,
                                    display_null=False))),
         ("pagination", PbField(pagination)), ("error", PbField(error)),
         ("disruptions",
          fields.List(NonNullNested(disruption_marshaller),
                      attribute="impacts")),
         ("feed_publishers",
          NonNullList(fields.Nested(feed_publisher,
                                    display_null=False)))
     ]
     if current_app.config.get('USE_SERPY', False):
         collections = serialize_with(api.PhysicalModesSerializer)
     else:
         collections = marshal_with(OrderedDict(self.collections),
                                    display_null=False)
     self.method_decorators.insert(1, collections)
コード例 #3
0
ファイル: decorators.py プロジェクト: vmulard/navitia
def get_serializer(serpy, marshall):
    if jormungandr.USE_SERPY:
        return serialize_with(serpy)
    else:
        return marshal_with(OrderedDict(marshall), display_null=False)
コード例 #4
0
def get_serializer(serpy):
    return serialize_with(serpy)