Yabe Initial-Data.yml обнаружил ошибку символа \ t - PullRequest
2 голосов
/ 15 августа 2011

Я работаю с тегами в руководстве по Yabe и столкнулся с проблемой с моим initial-data.yml

. Я уже подтвердил, что это похоже на пример, в котором не хватает только копии и вставки.

вот что я вижу

Malformed YAML 

Cannot parse the /conf/initial-data.yml file: found character '\t' that cannot start any token 


In /conf/initial-data.yml (around line 15)

11:     password:       secret
12:     fullname:       Jeff    
13: 
14: Tag(play):
15:     name:           Play
16:     
17: Tag(architecture):
18:     name:           Architecture
19:     
20: Tag(test):
21:     name:           Test

вот мой yml

User(bob):
    email:          bob@gmail.com
    password:       secret
    fullname:       Bob
    isAdmin:        true

User(jeff):
    email:          jeff@gmail.com
    password:       secret
    fullname:       Jeff    

Tag(play):
    name:           Play

Tag(architecture):
    name:           Architecture

Tag(test):
    name:           Test

Tag(mvc):
    name:           MVC    

Post(firstBobPost):
    title:          About the model layer
    postedAt:       2009-06-14
    author:         bob
    content:        >
                    The model has a central position in a Play! application. It is the domain-specific 
                    representation of the information on which the application operates.

                    Martin fowler defines it as:

                    Responsible for representing concepts of the business, information about the 
                    business situation, and business rules. State that reflects the business situation 
                    is controlled and used here, even though the technical details of storing it are 
                    delegated to the infrastructure. This layer is the heart of business software.

Post(secondBobPost):
    title:          Just a test of YABE
    postedAt:       2009-03-25
    author:         bob
    content:        >
                    Well, it's just a test.

Post(jeffPost):
    title:          The MVC application
    postedAt:       2009-06-06
    author:         jeff
    tags:
                    - play
                    - architecture
                    - mvc
    content:        >
                    A Play! application follows the MVC architectural pattern as applied to the 
                    architecture of the Web.

                    This pattern splits the application into separate layers: the Presentation 
                    layer and the Model layer. The Presentation layer is further split into a 
                    View and a Controller layer.

Comment(c1):
    author:         Guest
    content:        >
                    You are right !
    postedAt:       2009-06-14
    post:           firstBobPost

Comment(c2):
    author:         Mike
    content:        >
                    I knew that ...
    postedAt:       2009-06-15
    post:           firstBobPost    

Comment(c3):
    author:         Tom
    content:        >
                    This post is useless ?
    postedAt:       2009-04-05
    post:           secondBobPost

Ответы [ 2 ]

5 голосов
/ 15 августа 2011

У вас есть вкладки в строке 15-23:

    name:\t\t\tPlay
\t
Tag(architecture):
    name:\t\t\tArchitecture
\t
Tag(test):
    name:\t\t\Test
\t
Tag(mvc):
    name:\t\t\tMVC    
\t

Вкладки запрещены в yaml :

Вкладки запрещены, поскольку ониобрабатываются по-разному различными редакторами и инструментами.А поскольку отступы так важны для правильной интерпретации YAML, эта проблема слишком сложна, чтобы даже пытаться ее решить.Действительно, Гвидо ван Россум из Python признал, что включение TAB в исходные тексты Python является головной болью для многих людей, и если бы он снова разрабатывал Python, он запретил бы им.

0 голосов
/ 15 августа 2011

Никогда не используйте символьную вкладку "\ t" в YAML в начале строки.Просто используйте ПРОСТРАНСТВА!

...